Submission #50936

#TimeUsernameProblemLanguageResultExecution timeMemory
50936spencercomptonICC (CEOI16_icc)C++17
Compilation error
0 ms0 KiB
#include "icc.h" using namespace std; int n; void findRoad(){ int a[n/2]; int b[n-n/2]; int ar[n]; for(int i = 0; i<n; i++){ ar[i] = i+1; } while(true){ for(int i = 0; i+1<n; i++){ int rem = n-i-1; int ra = i + (rand()%rem) + 1; swap(ar[i],ar[ra]); } for(int i = 0; i<n; i++){ if(i<n/2){ a[i] = ar[i]; } else{ b[i-n/2] = ar[i]; } } if(query(n/2,n-n/2,a,b)){ int low1 = 0; int high1 = n/2-1; while(low1<high1){ int mid = (low1+high1)/2; int ta[mid]; for(int i = 0; i<mid; i++){ ta[i] = a[i]; } if(query(mid,n-n/2,ta,b)){ high1 = mid; } else{ low1 = mid+1; } } int low2 = 0; int high2 = n-n/2-1; while(low2<high2){ int mid = (low2+high2)/2; int tb[mid]; for(int i = 0; i<mid; i++){ tb[i] = b[i]; } if(query(n/2,mid,a,tb)){ high1 = mid; } else{ low1 = mid+1; } } int ans1 = a[low]; int ans2 = b[low]; if(ans1>ans2){ swap(ans1,ans2); } setRoad(ans1,ans2); break; } } } void run(int N){ n = N; for(int n=1; n<N; n++) findRoad(); }

Compilation message (stderr)

icc.cpp: In function 'void findRoad()':
icc.cpp:17:18: error: 'rand' was not declared in this scope
    int ra = i + (rand()%rem) + 1; 
                  ^~~~
icc.cpp:17:18: note: suggested alternative: 'ra'
    int ra = i + (rand()%rem) + 1; 
                  ^~~~
                  ra
icc.cpp:18:4: error: 'swap' was not declared in this scope
    swap(ar[i],ar[ra]);
    ^~~~
icc.cpp:59:17: error: 'low' was not declared in this scope
    int ans1 = a[low];
                 ^~~
icc.cpp:59:17: note: suggested alternative: 'low2'
    int ans1 = a[low];
                 ^~~
                 low2
icc.cpp:62:5: error: 'swap' was not declared in this scope
     swap(ans1,ans2);
     ^~~~