Submission #1055540

#TimeUsernameProblemLanguageResultExecution timeMemory
1055540MrPavlitoCave (IOI13_cave)C++17
0 / 100
65 ms600 KiB
#include "cave.h" #include <bits/stdc++.h> //#define int long long #define pb push_back #define mp make_pair #define all(x) (x).begin(),(x).end() #define fi first #define sc second #define endl "\n" #define pii pair<int,int> using namespace std; const int MAXN = 5e3+5; const int mod7 = 1e9+7; const long long inf = 1e18; void exploreCave(int N) { int n = N; int trenutnacomb[n]; int solved[n]; for(int i=0; i<n; i++)trenutnacomb[i] = 0, solved[i] = 0; for(int i=0; i<n; i++) { int t = tryCombination(trenutnacomb); bool zatvorena = 1; if(t==-1 || t>i) zatvorena = 0; if(zatvorena) { int l = 0; int r = n-1; while(l<r) { int mid = l+r >> 1; int pre[n]; for(int i=0; i<n; i++)pre[i] = trenutnacomb[i]; for(int i=l; i<= mid; i++)if(!solved[i])trenutnacomb[i] ^= 1; int p = tryCombination(trenutnacomb); if(p== -1 || p > i)r = mid; else l = mid+1; for(int i=0; i<n; i++)pre[i] = trenutnacomb[i]; } solved[i] = l; trenutnacomb[l] ^= 1; } else { int l = 0; int r = n-1; while(l<r) { int mid = l+r >> 1; int pre[n]; for(int i=0; i<n; i++)pre[i] = trenutnacomb[i]; for(int i=l; i<= mid; i++)if(!solved[i])trenutnacomb[i] ^= 1; int p = tryCombination(trenutnacomb); if(p == i)r = mid; else l = mid+1; for(int i=0; i<n; i++)pre[i] = trenutnacomb[i]; } solved[i] = l; trenutnacomb[l] ^= 1; } } answer(trenutnacomb, solved); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:35:28: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   35 |                 int mid = l+r >> 1;
      |                           ~^~
cave.cpp:36:21: warning: variable 'pre' set but not used [-Wunused-but-set-variable]
   36 |                 int pre[n];
      |                     ^~~
cave.cpp:53:28: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   53 |                 int mid = l+r >> 1;
      |                           ~^~
cave.cpp:54:21: warning: variable 'pre' set but not used [-Wunused-but-set-variable]
   54 |                 int pre[n];
      |                     ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...