제출 #1313179

#제출 시각아이디문제언어결과실행 시간메모리
1313179sitingfakeCave (IOI13_cave)C++20
46 / 100
12 ms512 KiB
#include<bits/stdc++.h>
#include "cave.h"
using namespace std;

// define
//bool M1;
//#define execute cerr << " Time: " << fixed << setprecision(6) << (1.0 * clock() / CLOCKS_PER_SEC) << "s\n";
//#define memory cerr << abs(&M2 - &M1)/1024.0/1024 << " MB" << "\n"


#define ll long long
#define ii pair <int , int>
#define iii pair <int , ii>
#define se second
#define fi first
#define all(v) (v).begin() , (v).end()
#define Unique(v) sort(all(v)) , v.resize(unique(all(v)) - v.begin())
#define bit(x,i) (((x) >> (i)) & 1LL)
#define flip(x,i) ((x) ^ (1LL << (i)))
#define ms(d,x) memset(d , x , sizeof(d))
#define exist __exist
#define ends __ends
#define visit visited
#define left __left
#define right __right
#define prev __prev
#define next __next
#define sitingfake 1
#define orz 1

//constant

const long long mod = 1e9 + 7;
const long long linf = 4557430888798830399LL;
const long long nlinf = -4485090715960753727LL;
const int inf = 1061109567;
const int ninf = -1044266559;
const int dx[] = {0 , -1 , 0 , 1};
const int dy[] = {-1 , 0 , 1 , 0};

template<typename T> bool maximize(T &a, const T &b)
{
    if(a < b) {a = b; return 1;}
    return 0;
}

template<typename T> bool minimize(T &a, const T &b)
{
    if(a > b) {a = b; return 1;}
    return 0;
}

void Plus(ll & a ,ll b)
{
    b %= mod;
    a += b;
    if(a < 0) a += mod;
    a %= mod;
    return;
}

void Mul(ll & a, ll b)
{
    (a *= (b % mod)) %= mod;
    return;
}

//code
const int maxn = 5e3 + 7;

void findState(int state[] , int n)
{
    queue <int> q;
    for(int i = 0; i < n; i++) q.push(i) , state[i] = 0;
    int cur = tryCombination(state);
    if(cur == -1) return;
    while(!q.empty())
    {
        int u = q.front();
        q.pop();
        state[u] ^= 1;
        int d = tryCombination(state);
        if(d == -1) return;
        if(d < cur)
        {
            state[u] ^= 1;
        }
        else if(d == cur)
        {
            q.push(u);
        }
        else
        {
            cur = d;
        }
    }
}
void exploreCave(int n)
{
    int state[n] , res[n];
    findState(state , n);
    for(int i = 0; i < n; i++)
    {
        state[i] ^= 1;
        res[i] = tryCombination(state);
        state[i] ^= 1;
    }
    answer(state , res);
}
/**
**/



#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...