# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1090427 |
2024-09-18T10:56:39 Z |
LeonidCuk |
Game (IOI13_game) |
C++17 |
|
645 ms |
40124 KB |
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
int n,m;
vector<long long int>st[101];
void init(int R,int C)
{
n=R;
m=C;
for(int i=0;i<n;i++)
{
st[i].resize(4*m+1);
}
}
void updatest(int i,int l,int r,int a,int b,long long int k)
{
if(l==r)
{
st[a][i]=k;
return;
}
int m=(l+r)/2;
if(b<=m)updatest(i*2,l,m,a,b,k);
else
{
updatest(i*2+1,m+1,r,a,b,k);
}
st[a][i]=gcd(st[a][i*2],st[a][i*2+1]);
}
long long int gsum(int i,int l,int r,int tl,int tr,int a)
{
if(tl>r||tr<l||l>r)
{
return 0;
}
if(tl<=l&&r<=tr)
{
return st[a][i];
}
int m=(l+r)/2;
return gcd(gsum(i*2,l,m,tl,tr,a),gsum(i*2+1,m+1,r,tl,tr,a));
}
long long int calculate(int r1,int r2,int c1,int c2)
{
long long int sum=0;
for(int i=r1;i<=c1;i++)
{
sum=gcd(sum,gsum(1,0,m-1,r2,c2,i));
}
return sum;
}
void update(int R,int C,long long int k)
{
updatest(1,0,m-1,R,C,k);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
352 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
556 ms |
40124 KB |
Output is correct |
5 |
Correct |
430 ms |
39804 KB |
Output is correct |
6 |
Correct |
517 ms |
37324 KB |
Output is correct |
7 |
Correct |
568 ms |
37224 KB |
Output is correct |
8 |
Correct |
450 ms |
37456 KB |
Output is correct |
9 |
Correct |
575 ms |
37148 KB |
Output is correct |
10 |
Correct |
516 ms |
36688 KB |
Output is correct |
11 |
Correct |
1 ms |
432 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
2 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Runtime error |
6 ms |
7108 KB |
Execution killed with signal 11 |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
692 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
600 KB |
Output is correct |
10 |
Correct |
1 ms |
600 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
645 ms |
40012 KB |
Output is correct |
13 |
Correct |
431 ms |
40020 KB |
Output is correct |
14 |
Correct |
501 ms |
37352 KB |
Output is correct |
15 |
Correct |
512 ms |
37200 KB |
Output is correct |
16 |
Correct |
468 ms |
37396 KB |
Output is correct |
17 |
Correct |
521 ms |
37224 KB |
Output is correct |
18 |
Correct |
460 ms |
36904 KB |
Output is correct |
19 |
Runtime error |
5 ms |
7000 KB |
Execution killed with signal 11 |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
356 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
611 ms |
40100 KB |
Output is correct |
13 |
Correct |
436 ms |
39856 KB |
Output is correct |
14 |
Correct |
499 ms |
37460 KB |
Output is correct |
15 |
Correct |
509 ms |
37204 KB |
Output is correct |
16 |
Correct |
420 ms |
37468 KB |
Output is correct |
17 |
Correct |
506 ms |
37208 KB |
Output is correct |
18 |
Correct |
447 ms |
36780 KB |
Output is correct |
19 |
Runtime error |
4 ms |
7000 KB |
Execution killed with signal 11 |
20 |
Halted |
0 ms |
0 KB |
- |