제출 #570880

#제출 시각아이디문제언어결과실행 시간메모리
570880nohaxjustsofloCave (IOI13_cave)C++17
0 / 100
148 ms428 KiB
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> order_set;
mt19937 mt_rand(chrono::high_resolution_clock::now().time_since_epoch().count());
//uniform_int_distribution<int> gen(-1e9, 1e8); ///(min, max)
//int random() {return gen(mt_rand);}
const int mxN = 1e6+50000;
const int mod = 998244353;
const int mxlogN = 34;
const int mxK = 26;
const int inf = 1e9;
const int K = 100000;
#include "cave.h"
int tryCombination(int S[]);
void answer(int S[], int D[]);
void exploreCave(int N)
{
    int n=N;
    int S[n], D[n];
    for(int i=0; i<n; i++) S[i]=0;
    vector<bool> done(n,0);
    for(int i=0; i<n; i++)
    {
        bool b=tryCombination(S)==i;
        vector<int> pos;
        for(int j=0; j<n; j++) if(!done[j]) pos.push_back(j);
        int l=0, r=n-i;
        while(r-l>1)
        {
            int m=(l+r)/2;
            for(int j=l; j<m; j++) S[pos[j]]=1;
            bool b2=tryCombination(S)==i;
            for(int j=l; j<m; j++) S[pos[j]]=0;
            if(b==b2) l=m;
            else r=m;

        }
        int p=pos[l];
        D[p]=i;
        S[p]=!b;
        done[p]=1;
    }
    answer(S,D);
}

/*
int main()
{
	int n; cin >> n;
	vector<int> s(n);
	for(int i=0; i<n; i++) cin >> s[i];
	cout << count_swaps(s);
	return 0;
}
*/
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…