제출 #869514

#제출 시각아이디문제언어결과실행 시간메모리
869514Samuraj죄수들의 도전 (IOI22_prison)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<ll,ll> pl;

const int max_pow = 2187;

int get_ter(int n, int poz){
    //max 8 miejsc
    int pow = max_pow;
    int ans = 0;
    while(pow > 0 && poz > 0){
        ans = n/pow;
        n -= ans*pow;

        poz--;
        pow /= 3;
    }
    return ans;
}

vector<vector<int>> devise_strategy(int n){
    vector<vector<int>> arr(29);

    //zabrac stany do ktorych nie wejdziemy
    for(int i = 0; i < 29; i++){
        int poz = i%10;
        int val = i/10;
        
        //check left
        if(poz%2 == 0) arr[i].push_back(0);
        else arr[i].push_back(1);

        for(int j = 1; j <= n; j++){
            //start
            int new_val = get_ter(j,poz);
            if(i == 0){
                arr[i].push_back(new_val*10+poz+1); 
                continue;
            }
            
            if(new_val < val)//pierwsza torba
                arr[i].push_back((arr[i][0] == 0 ? -1 : -2));
            else if(new_val > val)//druga torba
                arr[i].push_back((arr[i][0] == 0 ? -2 : -1));
            else
                arr[i].push_back(get_ter(j,poz+1)*10+poz+1);
        }
    }       
    

    return arr;
}


#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...