이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prison.h"
#include <cmath>
#include <vector>
#include <iostream>
using namespace std;
std::vector<std::vector<int>> devise_strategy(int N) {
vector<vector<int>> ans;
vector<int> temp(N+1,0);
for(int i=0;i<5;i++){
temp = vector<int> (N+1,0);
if(i==0){
ans.push_back(temp);
continue;
}
for(int j=1;j<N+1;j++){
int a = (int)(j/pow(10,4-i))%10;
temp[j] = i*10 + a;
}
ans.push_back(temp);
}
for(int i=5;i<10;i++){
temp = vector<int> (N+1,0);
ans.push_back(temp);
}
for(int i=10;i<50;i++){
temp = vector<int> (N+1,0);
temp[0] = 1;
// cout << i << " -> ";
for(int j=1;j<N+1;j++){
int pos = i/10;
int a = i%10;
int b = (int)(j/pow(10,4-pos))%10;
// cout << "{" << a << "," << b << "," << pos << "} ";
if(a>b)temp[j] = -1;
else if(a<b)temp[j] = -2;
else {
if((i/10) == 4)temp[j] = 0;
else temp[j] = (i/10)+1;
}
}
// cout << endl;
ans.push_back(temp);
}
// int counter = 0;
// for(auto a: ans){
// cout << counter << " -> ";
// for(auto b: a){
// cout << b << " ";
// }cout << endl;
// counter ++;
// }
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |