Submission #1259658

#TimeUsernameProblemLanguageResultExecution timeMemory
1259658comgaTramAnh게임 (IOI13_game)C++20
10 / 100
1 ms584 KiB
#include <bits/stdc++.h>
#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;
}
long long a[105][105]; 

void init(int R, int C) {
  for (int i = 0; i < R; i++) {
    for (int j = 0; j < C; j++) {
      a[i][j] = 0; 
    }
  }  
}

void update(int P, int Q, long long K) {
  a[P][Q] = K; 
}

long long calculate(int P, int Q, int U, int V) {
    long long  ans = a[P][Q]; 
    for (int i = P; i <= U; i++) {
      for (int j = Q; j <= V; j++) {
        ans = gcd2(ans, a[i][j]); 
      }
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...