This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <unordered_map>
#include <deque>
#include <set>
#include <unordered_set>
#include <algorithm>
#define ll long long
using namespace std;
int max_count = 0;
unordered_map<int,pair<ll,ll> > copygarbage;
void recurse(unordered_map<int,pair<ll,ll> > gyms, ll level, int count){
if(gyms.size() == 0){
max_count = max(max_count,count);
} else {
for(auto elem: gyms){
if(level <= elem.second.first){//if level less than level cap
copygarbage = gyms;
copygarbage.erase(elem.first);
recurse(copygarbage, level + elem.second.second, count + 1);
}
}
max_count = max(max_count,count);//if I exhaust all I still need to check lol
}
}
int main(){
//subtask 1 of problem 2 complete search dfs
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
if(n <= 3){
unordered_map <int, vector<int> > towers;
int x, y;
for(int i = 0; i < n; i++){
cin >> x >> y;
towers[i] = {x,y,0,i};// last digit is to see if it has tower on top but we dk rn
}
if(n == 1){
cout << 1 << endl;
} else if (n == 2){
cout << 11 << endl;
} else {
vector<int> t1 = towers[0];
vector<int> t2 = towers[1];
vector<int> t3 = towers[2];
if((t1.at(0) == t2.at(0) && t2.at(0) == t3.at(0)) || (t1.at(1) == t2.at(1) && t2.at(1) == t3.at(1))){
//if they are all in 1 line
vector< vector<int> > stws = {t1,t2,t3};
sort(stws.begin(),stws.end());
//this should sort by either x or y.
//now that they are in order
stws.at(0).at(2) = 1;
stws.at(1).at(2) = 0;
stws.at(2).at(2) = 1;
towers[stws.at(0).at(3)] = stws.at(0);
towers[stws.at(1).at(3)] = stws.at(1);
towers[stws.at(2).at(3)] = stws.at(2);
for(int i = 0; i < 3; i++){
cout << towers[i].at(2);
}
cout << endl;
} else {
cout << 111 << endl;
}
}
} else {
cout << "AHHHH" << endl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |