Submission #479978

#TimeUsernameProblemLanguageResultExecution timeMemory
479978robellCave (IOI13_cave)C++17
0 / 100
154 ms332 KiB
#pragma GCC optimize("O2") #include <bits/stdc++.h> #include "cave.h" #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set; typedef long long ll; #define pb push_back #define eb emplace_back #define countbits __builtin_popcount #define beg0 __builtin_clz #define terminal0 __builtin_ctz int mod=1e9+7; void setIO(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } void setIO(string f){ freopen((f+".in").c_str(),"r",stdin); freopen((f+".out").c_str(),"w",stdout); setIO(); } void exploreCave(int N){ int pos[N]; int ans[N]; memset(pos,0,sizeof(pos)); memset(ans,-1,sizeof(ans)); while (true){ int door = tryCombination(pos); if (door<0){ for (int i=0;i<N;i++){ if (ans[i]<0){ pos[i]=(pos[i]+1)%2; ans[i]=tryCombination(pos); pos[i]=(pos[i]+1)%2; } } break; }else{ for (int i=0;i<N;i++){ if (ans[i]<0){ pos[i]=(pos[i]+1)%2; int nval = tryCombination(pos); if (nval<door){ ans[i]=nval; pos[i]=(pos[i]+1)%2; }else if (nval>door){ ans[i]=door; }else{ pos[i]=(pos[i]+1)%2; } } } } } int keys[N];for (int i=0;i<N;i++) keys[i]=(pos[i]+1)%2; int doors[N];for (int i=0;i<N;i++) doors[i]=ans[i]; answer(keys,doors); }

Compilation message (stderr)

cave.cpp: In function 'void setIO(std::string)':
cave.cpp:20:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |  freopen((f+".in").c_str(),"r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cave.cpp:21:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |  freopen((f+".out").c_str(),"w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...