Submission #1090433

# Submission time Handle Problem Language Result Execution time Memory
1090433 2024-09-18T11:00:31 Z LeonidCuk Game (IOI13_game) C++17
37 / 100
13000 ms 36152 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
int n,m;
vector<long long int>st[2001];
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 348 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 0 ms 856 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 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 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 616 ms 35828 KB Output is correct
5 Correct 402 ms 36112 KB Output is correct
6 Correct 489 ms 32848 KB Output is correct
7 Correct 504 ms 32592 KB Output is correct
8 Correct 400 ms 33428 KB Output is correct
9 Correct 448 ms 32752 KB Output is correct
10 Correct 360 ms 32088 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 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 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Execution timed out 13073 ms 33192 KB Time limit exceeded
13 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 796 KB Output is correct
4 Correct 0 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 344 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 621 ms 35860 KB Output is correct
13 Correct 453 ms 36152 KB Output is correct
14 Correct 489 ms 32852 KB Output is correct
15 Correct 512 ms 32628 KB Output is correct
16 Correct 380 ms 33228 KB Output is correct
17 Correct 492 ms 32612 KB Output is correct
18 Correct 396 ms 32084 KB Output is correct
19 Execution timed out 13018 ms 33292 KB Time limit exceeded
20 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 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 0 ms 604 KB Output is correct
7 Correct 1 ms 348 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 592 ms 35800 KB Output is correct
13 Correct 408 ms 35948 KB Output is correct
14 Correct 506 ms 32712 KB Output is correct
15 Correct 475 ms 32592 KB Output is correct
16 Correct 432 ms 33396 KB Output is correct
17 Correct 488 ms 32512 KB Output is correct
18 Correct 437 ms 32084 KB Output is correct
19 Execution timed out 13061 ms 33432 KB Time limit exceeded
20 Halted 0 ms 0 KB -