Submission #306493

#TimeUsernameProblemLanguageResultExecution timeMemory
306493giorgikobComparing Plants (IOI20_plants)C++14
Compilation error
0 ms0 KiB
//#include "plants.h" #include <cstdio> #include <cassert> #include <vector> #include<bits/stdc++.h> #define ll long long #define ff first #define ss second #define pb push_back using namespace std; static int k, q; static std::vector<int> r; static std:: vector<int> x; static std:: vector<int> y; static std:: vector<int> answer; vector<int>v; int n; void init(int k, std::vector<int> r) { n = r.size(); if(k == 2){ v = r; } return; } bool check(int x,int y){ for(int i = x; i != y; i--){ if(v[i] != 1){ return false; } if(i == 0) i = n; } return true; } int compare_plants(int x, int y) { if(check((x-1+n)%n,(y-1+n)%n)) return 1; if(check((y-1+n)%n,(x-1+n)%n)) return -1; return 0; } int main() { assert(scanf("%d%d%d", &n, &k, &q) == 3); r.resize(n); answer.resize(q); for (int i = 0; i < n; i++) { int value; assert(scanf("%d", &value) == 1); r[i] = value; } x.resize(q); y.resize(q); for (int i = 0; i < q; i++) { assert(scanf("%d%d", &x[i], &y[i]) == 2); } fclose(stdin); init(k, r); for (int i = 0; i < q; i++) { answer[i] = compare_plants(x[i], y[i]); } for (int i = 0; i < q; i++) { printf("%d\n", answer[i]); } fclose(stdout); return 0; }

Compilation message (stderr)

/tmp/cchdVO5P.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccNDDgy6.o:plants.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status