Submission #723315

#TimeUsernameProblemLanguageResultExecution timeMemory
723315MardukA Difficult(y) Choice (BOI21_books)C++14
Compilation error
0 ms0 KiB
void solve(int N, int K, long long A, int S){ vector<int> sol; int lo = 0, hi = N+1; while(hi-lo>1){ int mid = (lo+hi)/2; if(skim(mid) >= A) hi = mid; else lo = mid; } int x = hi; int vx = skim(i); long long ans = 0; vector<int> f,l; f.clear(); l.clear(); for(int i = 1;i<K;i++){ long long q = skim(i); ans+=q; f.push_back(q); q = skim(x-i); l.push_back(q); } if(ans+vx >= A && ans+vx <= 2*A){ for(int i = 1;i<K;i++) sol.push_back(i); sol.push_back(x); return sol; } if(K>=x) impossible(); f.push_back(skim(K)); ans+=f[K-1]; if(ans >= A && ans <= 2*A){ for(int i = 1;i<=K;i++) sol.push_back(i); return sol; } for(int i = 0;i<K;i++){ if(f[i] == l[i]) impossible(); ans-=f[i]; ans+=l[i]; if(ans >= A && ans <= 2*A){ for(int j = 1+i+1;j<=K;j++) sol.push_back(j); for(int j = x-1;j>=x-1-i;j--) sol.push_back(j); return sol; } } impossible(); }

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:3:5: error: 'vector' was not declared in this scope
    3 |     vector<int> sol;
      |     ^~~~~~
books.cpp:3:12: error: expected primary-expression before 'int'
    3 |     vector<int> sol;
      |            ^~~
books.cpp:9:12: error: 'skim' was not declared in this scope
    9 |         if(skim(mid) >= A) hi = mid;
      |            ^~~~
books.cpp:14:19: error: 'i' was not declared in this scope
   14 |     int vx = skim(i);
      |                   ^
books.cpp:14:14: error: 'skim' was not declared in this scope
   14 |     int vx = skim(i);
      |              ^~~~
books.cpp:17:12: error: expected primary-expression before 'int'
   17 |     vector<int> f,l;
      |            ^~~
books.cpp:18:5: error: 'f' was not declared in this scope
   18 |     f.clear(); l.clear();
      |     ^
books.cpp:18:16: error: 'l' was not declared in this scope
   18 |     f.clear(); l.clear();
      |                ^
books.cpp:29:32: error: 'sol' was not declared in this scope
   29 |         for(int i = 1;i<K;i++) sol.push_back(i);
      |                                ^~~
books.cpp:30:9: error: 'sol' was not declared in this scope
   30 |         sol.push_back(x);
      |         ^~~
books.cpp:31:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   31 |         return sol;
      |                ^~~
books.cpp:34:14: error: 'impossible' was not declared in this scope
   34 |     if(K>=x) impossible();
      |              ^~~~~~~~~~
books.cpp:40:33: error: 'sol' was not declared in this scope
   40 |         for(int i = 1;i<=K;i++) sol.push_back(i);
      |                                 ^~~
books.cpp:41:16: error: 'sol' was not declared in this scope
   41 |         return sol;
      |                ^~~
books.cpp:45:26: error: 'impossible' was not declared in this scope
   45 |         if(f[i] == l[i]) impossible();
      |                          ^~~~~~~~~~
books.cpp:49:41: error: 'sol' was not declared in this scope
   49 |             for(int j = 1+i+1;j<=K;j++) sol.push_back(j);
      |                                         ^~~
books.cpp:50:43: error: 'sol' was not declared in this scope
   50 |             for(int j = x-1;j>=x-1-i;j--) sol.push_back(j);
      |                                           ^~~
books.cpp:51:20: error: 'sol' was not declared in this scope
   51 |             return sol;
      |                    ^~~
books.cpp:54:5: error: 'impossible' was not declared in this scope
   54 |     impossible();
      |     ^~~~~~~~~~