| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1362345 | frogrammer | A String Problem (EGOI25_stringproblem) | C++20 | 55 ms | 6900 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int n;
cin>>n;
map<int,int> mid;
vector<pair<int,int>> strings;
int maxCnt = 0;
int idx = 1;
int a,b;
for(int i=0;i<n;i++){
cin>>a>>b;
strings.push_back({max(a,b),min(a,b)});
if(a%2!=b%2){
int val = (a+b)%(2*n);
//cout<<val<<" "<<a<<" "<<b<<endl;
mid[val]++;
if(maxCnt < mid[val]){
maxCnt = mid[val];
idx = val;
}
}
}
cout<<n-maxCnt<<"\n";
int result;
vector<bool> pick(2*n,0);
for(int i=0;i<n;i++){
a = strings[i].first;
b = strings[i].second;
if((a+b)%2==0 || (a+b)%(2*n) != idx){
if(!pick[a]){
if(a>idx) result = idx+2*n-a;
else result = idx-a;
pick[a] = 1;
cout<<i<<" "<<b<<" "<<result<<"\n";
}else{
if(b>idx) result = idx+2*n-b;
else result = idx-b;
pick[b] = 1;
cout<<i<<" "<<a<<" "<<result<<"\n";
}
pick[result] = 1;
}else{
pick[a] = 1;
pick[b] = 1;
}
}
return 0;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
