Submission #965690

# Submission time Handle Problem Language Result Execution time Memory
965690 2024-04-19T05:26:31 Z Amr Game (IOI13_game) C++17
Compilation error
0 ms 0 KB
#include "game.h"
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll siz = 1;
const int N = 2e3;
ll seg[102][N];
ll r , c;
long long gcd2(long long X, long long Y) {
    long long tmp;
    if(X<Y) swap(X,Y);
    while (X != Y && Y != 0) {
        tmp = X;
        X = Y;
        Y = tmp % Y;
    }
    return X;
}
void upd(ll ver, ll in , ll val , ll x = 0, ll lx = 0, ll rx = siz)
{
   // cout << lx <<  " " << rx << "   ";
    if(rx-lx==1)
    {
        seg[ver][x] = val;
        return;
    }
    ll mid = (lx+rx)/2;
    if(in<mid)
    upd(ver,in,val,2*x+1,lx,mid);
    else
    upd(ver,in,val,2*x+2,mid,rx);
    seg[ver][x] = gcd2(seg[ver][2*x+1],seg[ver][2*x+2]);
   // cout << seg[ver][] << " ";
}
ll get(ll ver, ll l ,ll r, ll x = 0, ll lx = 0, ll rx = siz)
{
    if(lx>=r||rx<=l) return 0;
    if(lx>=l&&rx<=r) return seg[ver][x];
    ll mid = (lx+rx)/2;
    ll s1 = get(ver,l,r,2*x+1,lx,mid);
    ll s2 = get(ver,l,r,2*x+2,mid,rx);
    return gcd2(s1,s2);
}
void init(int R, int C) {
    r = R , c = C;
    siz = 1;
    while(siz<=c) siz*=2;
    siz*=2;
}

void update(int P, int Q, long long K) {
   upd(P,Q,K);
  // cout << seg[P][0] << endl;
}

long long calculate(int P, int Q, int U, int V) {
    ll gcd3 = 0;
    for(int i = P; i <= U; i++)
    {
        //cout << get(i,Q,V+1) <<  endl;
        gcd 3= gcd2(gcd3,get(i,Q,V+1));
    }
    return gcd3;
}

Compilation message

game.cpp: In function 'long long int calculate(int, int, int, int)':
game.cpp:61:12: error: expected ';' before numeric constant
   61 |         gcd 3= gcd2(gcd3,get(i,Q,V+1));
      |            ^~
      |            ;
game.cpp:61:39: error: statement cannot resolve address of overloaded function
   61 |         gcd 3= gcd2(gcd3,get(i,Q,V+1));
      |                                       ^