ABC 252, in process of making c, got idea but got sidetracked

This commit is contained in:
2022-05-29 23:42:21 +02:00
parent 841394f84c
commit 52cafc60f8
8 changed files with 238 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<map<int, int>> reels(n);
for(int i = 0; i < n; ++i){
long long reel_in;
cin >> reel_in;
for(int j = 9; j >= 0; --j){
int l = reel_in % 10;
reel_in /= 10;
reels[i][l] = j;
}
}
set<int> button_presses;
int min_time = 100000;
for(int i = 0; i < 10; ++i){
button_presses.clear();
for(int j = 0; j < n; ++j){
int time = reels[i][j];
while(button_presses.count(time)){
time += 10;
}
button_presses.insert(time);
if(time < min_time){
min_time = time;
}
}
}
cout << min_time << endl;
cout << flush;
return 0;
}