제출 #899261

#제출 시각아이디문제언어결과실행 시간메모리
899261aykhn동굴 (IOI13_cave)C++17
0 / 100
2027 ms608 KiB
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
 
#define db long double
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define endl '\n'
#define all(x) x.begin(), x.end()
#define fastio\
    ios_base::sync_with_stdio(0);\
    cin.tie(0);\
    cout.tie(0)\
 
void exploreCave(int n){
    int type[n], ind[n], qry[n];
    map<int, int> done;
    for(int i = 0; i < n; i++){
        int l = 0, r = n - 1, index, p;
        for(int j = 0; j < n; j++){
            if(done.count(j)){
                qry[j] = done[j];
            }
            else{
                qry[j] = 0;
            }
        }
        if(tryCombination(qry) >= i + 1){
            p = 0;
        }
        else{
            p = 1;
        }
        while(l < r){
            int mid = (l + r) / 2;
            for(int j = 0; j < n; j++){
                if(done.count(j)){
                    qry[j] = done[j];
                  	continue;
                }
              	if (l <= j && j <= mid){
                  	qry[j] = p;
                }
              	else if (mid < j && j <= r) qry[j] = 1 - p;
            }
            if(tryCombination(qry) >= i + 1){
                r = mid;
            }
            else{
                l = mid + 1;
            }
        }
        done[l] = p;
        type[l] = p;
        ind[l] = i;
    }
    answer(type, ind);
}

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:24:31: warning: unused variable 'index' [-Wunused-variable]
   24 |         int l = 0, r = n - 1, index, p;
      |                               ^~~~~
#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...