제출 #1331400

#제출 시각아이디문제언어결과실행 시간메모리
1331400AndreyPavlovA String Problem (EGOI25_stringproblem)C++20
50 / 100
27 ms3800 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;
        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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...