Submission #1272634

#TimeUsernameProblemLanguageResultExecution timeMemory
1272634raditya_noorXylophone (JOI18_xylophone)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int diff[n + 1] = {0}; for(int i = 2; i <= n; i++){ cout << "query(" << i - 1 << ", " << i << ")" << endl; cin >> diff[i]; } int mult[n + 1] = {0}; mult[1] = 1, mult[2] = 1; for(int i = 3, add; i <= n; i++){ cout << "query(" << i - 2 << ", " << i << ")" << endl; cin >> add; if(add < diff[i - 1] + diff[i]) mult[i] = -1; else mult[i] = 1; } int arr[n + 1] = {0}, curm = mult[1], add = n; for(int i = 2; i <= n; i++){ curm *= mult[i]; arr[i] = arr[i - 1] + curm * diff[i]; add = min(add, n - arr[i]); } bool mun = 0; int madd = 0; for(int i = 1; i <= n; i++){ arr[i] += add; if(arr[i] == n && !mun){ madd = n + 1; }else if(arr[i] == 1) mun = 1; } for(int i = 1; i <= n; i++){ cout << "answer(" << i << ", " << abs(madd - arr[i]) << ')' << endl; } }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccPZkqof.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccmdY33i.o:xylophone.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccPZkqof.o: in function `main':
grader.cpp:(.text.startup+0x30): undefined reference to `solve(int)'
collect2: error: ld returned 1 exit status