ABC 252, in process of making c, got idea but got sidetracked
This commit is contained in:
51
atcoder/beginner_contests/252/c.cpp
Normal file
51
atcoder/beginner_contests/252/c.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user