제출 #1226653

#제출 시각아이디문제언어결과실행 시간메모리
1226653Theo830Sphinx's Riddle (IOI24_sphinx)C++20
24 / 100
32 ms656 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9+7;
const ll MOD = 998244353;
typedef pair<ll,ll> ii;
#define iii pair<ll,ii>
#define id pair<ll,vector<ll> >
#define f(i,a,b) for(ll i = a;i < b;i++)
#define pb push_back
#define vll vector<ll>
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
///I hope I will get uprating and don't make mistakes
///I will never stop programming
///sqrt(-1) Love C++
///Please don't hack me
///@TheofanisOrfanou Theo830
///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst)
///Stay Calm
///Look for special cases
///Beware of overflow and array bounds
///Think the problem backwards
///Training
#include "sphinx.h"
std::vector<int> find_colours(int n, std::vector<int> x, std::vector<int> y){
    int m = x.size();
    std::vector<int> ans(n, 0);
    f(i,0,n){
        ll l = 0,r = n-1;
        ll res = n-1;
        while(l <= r){
            ll mid = (l+r)/2;
            vector<int>nodes;
            f(j,0,n){
                if(nodes.size() < mid+1 && j != i){
                    nodes.pb(j);
                }
            }
            vector<int> e(n,n);
            f(j,0,mid+1){
                e[nodes[j]] = j;
            }
            e[i] = -1;
            int x = perform_experiment(e);
            if(x == (1 + (nodes.size() < n-1) + mid)){
                r = mid - 1;
                res = min(res,mid);
            }
            else{
                l = mid + 1;
            }
        }
        ans[i] = res;
    }
    return ans;
}


#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...
#Verdict Execution timeMemoryGrader output
Fetching results...