QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#627645 | #7716. Average Value | Afterlife# | WA | 7ms | 7308kb | C++20 | 1018b | 2024-10-10 16:35:51 | 2024-10-10 16:35:52 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int mod[] = {1000000009 , 1000000007 , 998244353} ;
int n ;
string a[100005];
bool ok[100005];
int t[100005];
int fpow(int a,int b,int mod) {
int ans = 1;
while(b) {
if(b & 1) ans = 1LL * ans * a %mod;
a = 1LL * a * a % mod ; b >>= 1;
}
return ans;
}
int main() {
ios::sync_with_stdio(false) ; cin.tie(0);
cin >> n;
for(int i = 1;i <= n;i++) {
cin >> a[i] ; ok[i] = 1;
}
for(int p = 0;p < 3;p++) {
int prod = 1;
for(int i = 1;i <= n;i++) {
int s = 0;
for(int j = 0;j < a[i].size();j++) s = (s * 10LL + a[i][j] - '0') % mod[p] ;
prod = 1LL * prod * s % mod[p];
t[i] = fpow(s , n , mod[p]) ;
}
for(int i = 1;i <= n;i++) {
if(t[i] != prod) ok[i] = 0;
}
}
for(int i = 1;i <= n;i++) {
if(ok[i]){
cout << i << '\n' ; return 0;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 6760kb
input:
5 2 4 8 16 32
output:
3
result:
ok 1 number(s): "3"
Test #2:
score: 0
Accepted
time: 2ms
memory: 6704kb
input:
2 123456789012345678901234567890 123456789012345678901234567890
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 2ms
memory: 6776kb
input:
10 64 8 64 4096 32768 8 64 8 8 8
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 1ms
memory: 6672kb
input:
10 64 8 512 64 8 64 64 512 8 512
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 1ms
memory: 6708kb
input:
10 1000 40 40 200 40 40 8 8 40 8
output:
2
result:
ok 1 number(s): "2"
Test #6:
score: 0
Accepted
time: 2ms
memory: 6716kb
input:
10 49 1512 2286144 1764 49 12348 294 1512 12348 294
output:
4
result:
ok 1 number(s): "4"
Test #7:
score: 0
Accepted
time: 0ms
memory: 6712kb
input:
10 125 102400 12800 25 1000 1600 12800 1000000 8000 1600000
output:
9
result:
ok 1 number(s): "9"
Test #8:
score: 0
Accepted
time: 1ms
memory: 6776kb
input:
2 3 3
output:
1
result:
ok 1 number(s): "1"
Test #9:
score: 0
Accepted
time: 1ms
memory: 6828kb
input:
3 8 8 8
output:
1
result:
ok 1 number(s): "1"
Test #10:
score: 0
Accepted
time: 0ms
memory: 6788kb
input:
100 2193839575200 3781876293492931691366400000 33793357970584576000000 285803704769965200000 61509520800 25117269296464800 10193665470128758800000 247709946781718074483200 1855691370 481415333760324314396172288000000 4114068743823360000 44652923193715200 386660596224000 11899021578210392449355694489...
output:
60
result:
ok 1 number(s): "60"
Test #11:
score: 0
Accepted
time: 0ms
memory: 6720kb
input:
200 9 81 81 729 27 243 81 9 9 81 27 81 81 27 27 81 729 9 2187 243 27 243 27 27 27 81 81 243 9 9 243 9 81 81 81 243 27 243 9 9 9 243 27 243 27 6561 81 243 9 27 81 243 243 243 27 243 2187 81 27 81 9 81 243 27 27 27 27 243 27 81 9 81 243 729 9 729 81 81 27 27 81 81 9 243 2187 729 81 6561 81 9 81 6561 8...
output:
2
result:
ok 1 number(s): "2"
Test #12:
score: 0
Accepted
time: 2ms
memory: 6724kb
input:
300 194275225472 125177336 82854821923556029619961856 194275225472 120461277512968958042544258176 2412121199460352 9673914949181816 131987335565935398595712 213484188390544 4711174217696 364087463027406826976 213484188390544 4711174217696 13662988056994816 204844344798331738620545024 414159325477655...
output:
63
result:
ok 1 number(s): "63"
Test #13:
score: 0
Accepted
time: 0ms
memory: 7240kb
input:
400 21929283671882206592 17629086342434516606372576 56444365018604240608 5942867098549947776 5203911644964928 20279403032 417074727908921697898468864 16540987880081831809331551744 1307199466945456428815871170186752 92410001393311618578688 465165529952536 20132416603060217964477481792 583947363664 63...
output:
42
result:
ok 1 number(s): "42"
Test #14:
score: 0
Accepted
time: 2ms
memory: 6740kb
input:
500 21051555843900960 249850582161494430000 1816364749464001386210016931357433600000 7341768508180412121274198864656000000 61813415877324177108000 68732479319737397073067054848000 39444700594683637565548297488000 2807114314158937776000 21259947417510845911025672388000000 2642223858144886592455561473...
output:
237
result:
ok 1 number(s): "237"
Test #15:
score: 0
Accepted
time: 7ms
memory: 7308kb
input:
10000 930675254966150476697259144985 930675254966150476697259144985 930675254966150476697259144985 930675254966150476697259144985 930675254966150476697259144985 930675254966150476697259144985 930675254966150476697259144985 930675254966150476697259144985 930675254966150476697259144985 930675254966150...
output:
1
result:
ok 1 number(s): "1"
Test #16:
score: -100
Wrong Answer
time: 3ms
memory: 6808kb
input:
20 107719672266498265320271265685604205784381792279599122302815354442418937683656313119561564257407747622723051484122122776196531317710873736680947075437249390884079983950231448281452805814938553575770634399403518420019404456036357307618141600751416322923873597821237097794397721069547931683875191740...
output:
1
result:
wrong answer 1st numbers differ - expected: '18', found: '1'