Submission #962727

#TimeUsernameProblemLanguageResultExecution timeMemory
962727danikoynovGame (IOI13_game)C++14
10 / 100
13088 ms8608 KiB
#include "game.h"

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

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;
}


void init(int R, int C)
{
    /* ... */
}

map < pair < int, int >, ll > board;

void update(int P, int Q, long long K)
{
     board[{P, Q}] = K;
    /* ... */
}

long long calculate(int P, int Q, int U, int V)
{
     map < pair < int, int >, ll > :: iterator it;
     ll res = 0;
     for (it = board.begin(); it != board.end(); it ++)
     {
          pair < int, int > cor = it -> first;
          if (cor.first >= P && cor.first <= U &&
              cor.second >= Q && cor.second <= V)
          {
               res = __gcd(res, it -> second);
          }
     }
    /* ... */
    return res;
}
#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...