# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
39183 |
2018-01-09T17:11:51 Z |
faustaadp |
Game (IOI13_game) |
C++14 |
|
13000 ms |
213716 KB |
#include "game.h"
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
long long fpb(long long X, long long Y) {
if(Y==0)
return X;
else
return fpb(Y,X%Y);
}
ll n,m,st[11][2440404],sk[101][2501],hz,i;
void un(ll aa,ll bb,ll cc,ll dd,ll ee,ll ff)
{
if(aa==bb)
{
if(n<=10)
st[ff][ee]=dd;
else
sk[ff][ee]=dd;
}
else
{
ll ce=(aa+bb)/2;
if(cc<=ce)
un(aa,ce,cc,dd,ee*2,ff);
else
un(ce+1,bb,cc,dd,ee*2+1,ff);
if(n<=10)
st[ff][ee]=fpb(st[ff][ee*2],st[ff][ee*2+1]);
else
sk[ff][ee]=fpb(sk[ff][ee*2],sk[ff][ee*2+1]);
}
}
ll hn(ll aa,ll bb,ll cc,ll dd,ll ee,ll ff)
{
if(dd<aa||bb<cc)
return 0;
else
if(cc<=aa&&bb<=dd)
{
if(n<=10)
return st[ff][ee];
else
return sk[ff][ee];
}
else
{
ll ce=(aa+bb)/2;
return fpb(hn(aa,ce,cc,dd,ee*2,ff),hn(ce+1,bb,cc,dd,ee*2+1,ff));
}
}
void init(int R, int C) {
n=R;
m=C;
}
void update(int P, int Q, long long K) {
un(0,m-1,Q,K,1,P);
}
long long calculate(int P, int Q, int U, int V) {
hz=0;
for(i=P;i<=U;i++)
hz=fpb(hz,hn(0,m-1,Q,V,1,i));
return hz;
}
Compilation message
grader.c: In function 'int main()':
grader.c:18:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
int res;
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
213716 KB |
Output is correct |
2 |
Correct |
0 ms |
213716 KB |
Output is correct |
3 |
Correct |
0 ms |
213716 KB |
Output is correct |
4 |
Correct |
0 ms |
213716 KB |
Output is correct |
5 |
Correct |
0 ms |
213716 KB |
Output is correct |
6 |
Correct |
0 ms |
213716 KB |
Output is correct |
7 |
Correct |
0 ms |
213716 KB |
Output is correct |
8 |
Correct |
0 ms |
213716 KB |
Output is correct |
9 |
Correct |
0 ms |
213716 KB |
Output is correct |
10 |
Correct |
0 ms |
213716 KB |
Output is correct |
11 |
Correct |
0 ms |
213716 KB |
Output is correct |
12 |
Correct |
0 ms |
213716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
213716 KB |
Output is correct |
2 |
Correct |
0 ms |
213716 KB |
Output is correct |
3 |
Correct |
0 ms |
213716 KB |
Output is correct |
4 |
Correct |
1703 ms |
213716 KB |
Output is correct |
5 |
Correct |
1129 ms |
213716 KB |
Output is correct |
6 |
Correct |
1456 ms |
213716 KB |
Output is correct |
7 |
Correct |
1469 ms |
213716 KB |
Output is correct |
8 |
Correct |
1296 ms |
213716 KB |
Output is correct |
9 |
Correct |
1603 ms |
213716 KB |
Output is correct |
10 |
Correct |
1413 ms |
213716 KB |
Output is correct |
11 |
Correct |
0 ms |
213716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
213716 KB |
Output is correct |
2 |
Correct |
0 ms |
213716 KB |
Output is correct |
3 |
Correct |
0 ms |
213716 KB |
Output is correct |
4 |
Correct |
0 ms |
213716 KB |
Output is correct |
5 |
Correct |
0 ms |
213716 KB |
Output is correct |
6 |
Correct |
0 ms |
213716 KB |
Output is correct |
7 |
Correct |
0 ms |
213716 KB |
Output is correct |
8 |
Correct |
0 ms |
213716 KB |
Output is correct |
9 |
Correct |
0 ms |
213716 KB |
Output is correct |
10 |
Correct |
0 ms |
213716 KB |
Output is correct |
11 |
Correct |
0 ms |
213716 KB |
Output is correct |
12 |
Execution timed out |
13000 ms |
213716 KB |
Execution timed out |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
213716 KB |
Output is correct |
2 |
Correct |
0 ms |
213716 KB |
Output is correct |
3 |
Correct |
0 ms |
213716 KB |
Output is correct |
4 |
Correct |
0 ms |
213716 KB |
Output is correct |
5 |
Correct |
0 ms |
213716 KB |
Output is correct |
6 |
Correct |
0 ms |
213716 KB |
Output is correct |
7 |
Correct |
0 ms |
213716 KB |
Output is correct |
8 |
Correct |
0 ms |
213716 KB |
Output is correct |
9 |
Correct |
0 ms |
213716 KB |
Output is correct |
10 |
Correct |
0 ms |
213716 KB |
Output is correct |
11 |
Correct |
0 ms |
213716 KB |
Output is correct |
12 |
Correct |
2133 ms |
213716 KB |
Output is correct |
13 |
Correct |
1189 ms |
213716 KB |
Output is correct |
14 |
Correct |
1426 ms |
213716 KB |
Output is correct |
15 |
Correct |
1459 ms |
213716 KB |
Output is correct |
16 |
Correct |
1096 ms |
213716 KB |
Output is correct |
17 |
Correct |
1393 ms |
213716 KB |
Output is correct |
18 |
Correct |
1169 ms |
213716 KB |
Output is correct |
19 |
Execution timed out |
13000 ms |
213716 KB |
Execution timed out |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
213716 KB |
Output is correct |
2 |
Correct |
0 ms |
213716 KB |
Output is correct |
3 |
Correct |
0 ms |
213716 KB |
Output is correct |
4 |
Correct |
0 ms |
213716 KB |
Output is correct |
5 |
Correct |
0 ms |
213716 KB |
Output is correct |
6 |
Correct |
0 ms |
213716 KB |
Output is correct |
7 |
Correct |
0 ms |
213716 KB |
Output is correct |
8 |
Correct |
0 ms |
213716 KB |
Output is correct |
9 |
Correct |
0 ms |
213716 KB |
Output is correct |
10 |
Correct |
0 ms |
213716 KB |
Output is correct |
11 |
Correct |
0 ms |
213716 KB |
Output is correct |
12 |
Correct |
1663 ms |
213716 KB |
Output is correct |
13 |
Correct |
1012 ms |
213716 KB |
Output is correct |
14 |
Correct |
1326 ms |
213716 KB |
Output is correct |
15 |
Correct |
1469 ms |
213716 KB |
Output is correct |
16 |
Correct |
1016 ms |
213716 KB |
Output is correct |
17 |
Correct |
1319 ms |
213716 KB |
Output is correct |
18 |
Correct |
1236 ms |
213716 KB |
Output is correct |
19 |
Execution timed out |
13000 ms |
213716 KB |
Execution timed out |
20 |
Halted |
0 ms |
0 KB |
- |