| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1331401 | AndreyPavlov | A String Problem (EGOI25_stringproblem) | C++20 | 29 ms | 3820 KiB |
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
using pii = pair<int,int>;
template <class T>
bool chmax (T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
ios::sync_with_stdio(false);
int n;
cin >> n;
vector <int> cnt(2 * n);
vector <pair <int, int>> a(n);
for (int i = 0; i < n; ++i) {
int u, v;
cin >> u >> v;
if (u > v) {
swap(u, v);
}
a[i] = {u, v};
cnt[(u + v) % (2 * n)]++;
}
int res = 0;
int j = -1;
for (int i = 1; i < 2 * n; i += 2) {
if (chmax(res, cnt[i])) {
j = i;
}
}
cout << n - res << '\n';
for (int i = 0; i < n; ++i) {
if ((a[i].first + a[i].second) % (2 * n) != j) {
cout << i << ' ' << a[i].second << ' ' << (j + 2 * n - a[i].first) % (2 * n) << '\n';
}
}
return 0;
}| # | 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... | ||||
