Submission #781983

#TimeUsernameProblemLanguageResultExecution timeMemory
781983Minindu206Cave (IOI13_cave)C++14
33 / 100
45 ms444 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; void exploreCave(int n) { int sw[n], st[n], temp[n]; for(int i=0;i<n;i++) st[i] = 0, sw[i] = -1; int cur = 0; for(int i=0;i<n;i++) { int cmb = tryCombination(st), swt = 1; if(cmb == -1) cmb = n; if(cmb > i || cmb == -1) swt = 0; // st[i] = swt; memset(temp, 1 - swt, sizeof(temp)); for(int j=0;j<n;j++) { if(sw[j] != -1) temp[j] = st[j]; } for(int j=0;j<n;j++) { if(sw[j] != -1) continue; temp[j] = swt; cmb = tryCombination(temp); if(cmb > i || cmb == -1) { sw[j] = i; st[j] = swt; break; } temp[j] = 1 - temp[j]; } // for(int j=0;j<n;j++) // cout << st[i] << " "; // cout << '\n'; // for(int j=0;j<n;j++) // cout << sw[i] << " "; // cout << '\n'; } answer(st, sw); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:8:9: warning: unused variable 'cur' [-Wunused-variable]
    8 |     int cur = 0;
      |         ^~~
#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...