Submission #1014538

# Submission time Handle Problem Language Result Execution time Memory
1014538 2024-07-05T06:15:15 Z huutuan Game (IOI13_game) C++14
0 / 100
1 ms 348 KB
#include "game.h"

long long gcd2(long long X, long long Y) {
   long long tmp;
   while (X != Y && Y != 0) {
      tmp = X;
      X = Y;
      Y = tmp % Y;
   }
   return X;
}

#include <bits/stdc++.h>

using namespace std;

int v[22000][3];
int sz;

void init(int R, int C) {
   
}

void update(int P, int Q, long long K) {
   for (int i=0; i<sz; ++i) if (v[i][0]==P && v[i][1]==Q){
      v[i][2]=K;
      return;
   }
   v[sz][0]=P; v[sz][1]=Q; v[sz][2]=K;
   ++sz;
}

long long calculate(int P, int Q, int U, int V) {
   long long ans=0;
   for (int i=0; i<sz; ++i) if (P<=v[i][0] && v[i][0]<=U && Q<=v[i][1] && v[i][1]<=V) ans=gcd2(ans, v[i][2]);
   return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -