Submission #250986

#TimeUsernameProblemLanguageResultExecution timeMemory
250986IsaacMorisMinerals (JOI19_minerals)C++14
Compilation error
0 ms0 KiB
#include<iostream> #include <bits/stdc++.h> #include "minerals.h" #define ll long long #define ld long double #define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); using namespace std; int low[N+4], high[N+4]; vector<int> v[N+4]; void Solve(int N) { vector<int> v1, v2; int last=0; for (int i = 1; i <= 2 * N; ++i) { int x=Query(i); if(x!=last) v1.push_back(i); else v2.push_back(i); last=x; } for(int i=0; i<N; i++) high[i]=N-1, low[i]=0; int good=1; bool p=1; while(good) { good=0; for(int i=0; i<N; i++) if(low[i]!=high[i]) v[(low[i]+high[i])/2].push_back(i); for(int i=0; i<N; i++) { int x=Query(v1[i]); while(!v[i].empty()) { int id=v[i].back(); good=1; v[i].pop_back(); int q=Query(v2[id]); if((q!=x && p) || (q==x && !p)) high[id]=i; else low[id]=i+1; } } p=!p; } for(int i=0; i<N; i++) Answer(v2[i], v1[low[i]]); }

Compilation message (stderr)

minerals.cpp:8:9: error: 'N' was not declared in this scope
 int low[N+4], high[N+4];
         ^
minerals.cpp:8:20: error: 'N' was not declared in this scope
 int low[N+4], high[N+4];
                    ^
minerals.cpp:9:15: error: 'N' was not declared in this scope
 vector<int> v[N+4];
               ^
minerals.cpp: In function 'void Solve(int)':
minerals.cpp:24:9: error: 'high' was not declared in this scope
         high[i]=N-1, low[i]=0;
         ^~~~
minerals.cpp:24:9: note: suggested alternative: 'sinh'
         high[i]=N-1, low[i]=0;
         ^~~~
         sinh
minerals.cpp:24:22: error: 'low' was not declared in this scope
         high[i]=N-1, low[i]=0;
                      ^~~
minerals.cpp:24:22: note: suggested alternative: 'pow'
         high[i]=N-1, low[i]=0;
                      ^~~
                      pow
minerals.cpp:31:16: error: 'low' was not declared in this scope
             if(low[i]!=high[i])
                ^~~
minerals.cpp:31:16: note: suggested alternative: 'pow'
             if(low[i]!=high[i])
                ^~~
                pow
minerals.cpp:31:24: error: 'high' was not declared in this scope
             if(low[i]!=high[i])
                        ^~~~
minerals.cpp:31:24: note: suggested alternative: 'sinh'
             if(low[i]!=high[i])
                        ^~~~
                        sinh
minerals.cpp:32:9: error: 'v' was not declared in this scope
         v[(low[i]+high[i])/2].push_back(i);
         ^
minerals.cpp:36:20: error: 'v' was not declared in this scope
             while(!v[i].empty())
                    ^
minerals.cpp:43:21: error: 'high' was not declared in this scope
                     high[id]=i;
                     ^~~~
minerals.cpp:43:21: note: suggested alternative: 'sinh'
                     high[id]=i;
                     ^~~~
                     sinh
minerals.cpp:45:21: error: 'low' was not declared in this scope
                     low[id]=i+1;
                     ^~~
minerals.cpp:45:21: note: suggested alternative: 'pow'
                     low[id]=i+1;
                     ^~~
                     pow
minerals.cpp:51:26: error: 'low' was not declared in this scope
         Answer(v2[i], v1[low[i]]);
                          ^~~
minerals.cpp:51:26: note: suggested alternative: 'pow'
         Answer(v2[i], v1[low[i]]);
                          ^~~
                          pow