Submission #1090301

# Submission time Handle Problem Language Result Execution time Memory
1090301 2024-09-18T08:04:04 Z vjudge1 Game (IOI13_game) C++17
37 / 100
13000 ms 36128 KB
#include "game.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define int long long

struct Seggy{
    vector<ll> s;

    void init(int n){
        s.resize(4 * n, 0);
    }

    void upd(int k,int tl,int tr,int p,ll v){
        if(tl == tr){
            s[k] = v;
            return;
        }
        int tm = (tl + tr) / 2;
        if(p <= tm)upd(k *2, tl, tm, p, v);
        else upd(k *2 + 1, tm + 1, tr, p, v);
        s[k] = __gcd(s[k * 2], s[k * 2 + 1]);
    }

    ll qry(int k,int tl,int tr,int l,int r){
        if(l > tr || tl > r)return 0;
        if(l <= tl && tr <= r)return s[k];
        int tm = (tl +tr) / 2;
        return __gcd(qry(k * 2,tl, tm, l, r), qry(k *2 + 1, tm + 1, tr, l, r));
    }
};

vector<Seggy> seg;

int n, m;

void init(signed R, signed C) {
    n = R, m = C;
    seg.resize(R);
    for(auto &u: seg)u.init(C);
}

void update(signed P, signed Q, long long K) {
    seg[P].upd(1, 0, m - 1, Q, K);
}

long long calculate(signed P, signed Q, signed U, signed V) {
    int g = 0;
    for(int i = P;i <= U;i++){
        g = __gcd(g, seg[i].qry(1, 0,m - 1,Q, V));
    }
    return g;
}
#define int signed

Compilation message

game.cpp:56: warning: "int" redefined
   56 | #define int signed
      | 
game.cpp:7: note: this is the location of the previous definition
    7 | #define int long long
      |
# 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 0 ms 348 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 0 ms 344 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 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 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 447 ms 35756 KB Output is correct
5 Correct 303 ms 36128 KB Output is correct
6 Correct 364 ms 32596 KB Output is correct
7 Correct 419 ms 32340 KB Output is correct
8 Correct 320 ms 33360 KB Output is correct
9 Correct 401 ms 32592 KB Output is correct
10 Correct 347 ms 32080 KB Output is correct
11 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 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 0 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 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Execution timed out 13092 ms 34472 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# 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 0 ms 348 KB Output is correct
5 Correct 0 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 0 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 460 ms 35668 KB Output is correct
13 Correct 320 ms 35920 KB Output is correct
14 Correct 370 ms 32844 KB Output is correct
15 Correct 393 ms 32352 KB Output is correct
16 Correct 325 ms 33360 KB Output is correct
17 Correct 398 ms 32596 KB Output is correct
18 Correct 337 ms 32252 KB Output is correct
19 Execution timed out 13079 ms 34232 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 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 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 0 ms 604 KB Output is correct
12 Correct 464 ms 35628 KB Output is correct
13 Correct 323 ms 35924 KB Output is correct
14 Correct 389 ms 32628 KB Output is correct
15 Correct 392 ms 32336 KB Output is correct
16 Correct 340 ms 33308 KB Output is correct
17 Correct 398 ms 32616 KB Output is correct
18 Correct 358 ms 32164 KB Output is correct
19 Execution timed out 13061 ms 34388 KB Time limit exceeded
20 Halted 0 ms 0 KB -