Submission #386384

#TimeUsernameProblemLanguageResultExecution timeMemory
386384ismoilovCave (IOI13_cave)C++14
12 / 100
557 ms688 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define all(x) (x).begin(), (x).end() #define rall(x) (x).begin(), (x).end() #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++) #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++) #define fv(c) for(int (a) = (1); (a) <= (c); (a)++) #define fz(c) for(int (a) = (0); (a) < (c); (a)++) #define fm(a,i,c) for(int (a) = (i); (a) > (c); (a)--) #define fmm(a,i,c) for(int (a) = (i); (a) >= (c); (a)--) #define pb push_back #define in insert #define ss second #define ff first void exploreCave(int n) { int v[n], a[n]; vector <int> s; fp(i,0,n) a[i] = -1, v[i] = 0, s.pb(i); int x = 0; fp(i,0,n){ //cout << "// " << i << " " << x << " " << s.size() << "\n"; fp(j,0,s.size()) v[s[j]] = x; int f = tryCombination(v); if(f == i) x = (x+1)%2; fp(j,0,s.size()) v[s[j]] = x; int l = 0, r = s.size(); while(l < r && (l+r)/2 < s.size()){ int m = (l + r)/2; fp(j,0,m) v[s[j]] = (x+1)%2; //cout << v[0] << " hf\n"; f = tryCombination(v); if(f > i || f == -1) l = m + 1; else{ fp(j,0,m) v[s[j]] = x; r = m; } //cout << l << " " << r << " lr\n"; } l = min(l, int(s.size())); v[i] = x; a[i] = s[l-1]; s.erase(s.begin()+l-1); } answer(v, a); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:10:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
cave.cpp:24:2: note: in expansion of macro 'fp'
   24 |  fp(i,0,n)
      |  ^~
cave.cpp:10:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
cave.cpp:27:2: note: in expansion of macro 'fp'
   27 |  fp(i,0,n){
      |  ^~
cave.cpp:10:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   10 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
cave.cpp:29:3: note: in expansion of macro 'fp'
   29 |   fp(j,0,s.size())
      |   ^~
cave.cpp:10:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                                      ~~~~^~~~~
cave.cpp:29:3: note: in expansion of macro 'fp'
   29 |   fp(j,0,s.size())
      |   ^~
cave.cpp:10:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   10 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
cave.cpp:34:3: note: in expansion of macro 'fp'
   34 |   fp(j,0,s.size())
      |   ^~
cave.cpp:10:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                                      ~~~~^~~~~
cave.cpp:34:3: note: in expansion of macro 'fp'
   34 |   fp(j,0,s.size())
      |   ^~
cave.cpp:37:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |   while(l < r && (l+r)/2 < s.size()){
      |                  ~~~~~~~~^~~~~~~~~~
cave.cpp:10:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   10 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
cave.cpp:39:4: note: in expansion of macro 'fp'
   39 |    fp(j,0,m)
      |    ^~
cave.cpp:10:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   10 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
cave.cpp:46:5: note: in expansion of macro 'fp'
   46 |     fp(j,0,m)
      |     ^~
#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...