Submission #1070803

#TimeUsernameProblemLanguageResultExecution timeMemory
1070803dostsCave (IOI13_cave)C++17
0 / 100
321 ms836 KiB
//Dost SEFEROĞLU
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
//#define int long long
#define pii pair<int,int>
#define ff first
#define ss second
#define sp << " " <<    
#define all(cont) cont.begin(),cont.end()
#define vi vector<int>
const int MOD = 1e9+7,inf = 2e18;
const int N = 1e5+50;
 
void exploreCave(int32_t N) {
    vector<pii> fix;
    int R[N],D[N];
    for (int i=0;i<N;i++) {
        int S[N];
        for (int i=0;i<N;i++) S[i] = 0;
        for (auto it : fix) S[it.ff] = it.ss;
        int real = tryCombination(S);
        int l = 1;
        int r = N;
        while (l<=r) {
            int m = (l+r) >> 1;
            int SS[N];
            for (int j=0;j<m;j++) SS[i] = S[i]^1;
            for (int j=m;j<N;j++) SS[i] = S[i];
            for (auto it : fix) S[it.ff] = it.ss;
            int test = tryCombination(S);
            if (test != real) {
                assert(test == i+1 || real == i+1);
                r = m-1;
            }
            else l = m+1;
        }
        if (real > i+1) fix.push_back({l,0});
        else fix.push_back({l,1});
        R[i] = fix.back().ff-1;
        D[i] = fix.back().ss;
    }
    answer(R,D);
}

Compilation message (stderr)

cave.cpp:12:29: warning: overflow in conversion from 'double' to 'int' changes value from '2.0e+18' to '2147483647' [-Woverflow]
   12 | const int MOD = 1e9+7,inf = 2e18;
      |                             ^~~~
cave.cpp: In function 'void exploreCave(int32_t)':
cave.cpp:27:17: warning: variable 'SS' set but not used [-Wunused-but-set-variable]
   27 |             int SS[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...