Submission #100514

# Submission time Handle Problem Language Result Execution time Memory
100514 2019-03-12T02:21:26 Z Sakamotoo Game (IOI14_game) C++14
Compilation error
0 ms 0 KB
#include "game.h"
#include<bits/stdc++.h>
using namespace std;

long long r,c;
long long x[30000],y[30000],val[30000];
vector<long long> v;
int ke;

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) {
    r=R;
    c=C;
}

void update(int P, int Q, long long K) {
    bool ada=true;
    for(int i=0; i<(int)v.size(); i++){
    	int ind=v[i];
    	if(x[ind]==P&&y[ind]==Q){
    		val[ind]=K;
    		ada=false;
		}
	}
	if(ada){
		v.push_back(ke);
		x[ke]=P;
		y[ke]=Q;
		val[ke]=K;
		ke++;
	}
}

long long calculate(int P, int Q, int U, int V) {
    long long now=0;
    for(int i=0; i<v.size(); i++){
    	int ind=v[i];
    	if(x[ind]>=P&&x[ind]<=U&&y[ind]>=Q&&y[ind]<=V) now=gcd2(now,val[ind]);
	}
	return now;
}

Compilation message

game.cpp: In function 'long long int calculate(int, int, int, int)':
game.cpp:45:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<v.size(); i++){
                  ~^~~~~~~~~
/tmp/cc040bAv.o: In function `main':
grader.cpp:(.text.startup+0x14): undefined reference to `initialize(int)'
grader.cpp:(.text.startup+0x57): undefined reference to `hasEdge(int, int)'
collect2: error: ld returned 1 exit status