Submission #834332

#TimeUsernameProblemLanguageResultExecution timeMemory
834332mindiyakPrisoner Challenge (IOI22_prison)C++17
5 / 100
19 ms19156 KiB
#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;
// }


std::vector<std::vector<int>> devise_strategy(int N) {

  vector<vector<int>> ans;

  vector<int> temp(N+1,0);
  
  for(int j=1;j<N+1;j++){
    temp[j] = j;
  }
  ans.push_back(temp);

  for(int i=1;i<N+1;i++){
    temp = vector<int> (N+1,0);
    temp[0] = 1;

    for(int j=1;j<N+1;j++){
      if(i>j)temp[j]=-2;
      else if(i<j)temp[j]=-1;
      else temp[j]=0;
    }
    

    ans.push_back(temp);
  }

  return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...