Submission #19554384


Source Code Expand

Copy
#include <bits/stdc++.h>

using namespace std;
int n, x, y, k, l, ans, db[3];
vector<pair<int, int> > a, b;
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n;
    for (int i=1; i<=n; i++) {
        cin >> x >> y;
        a.push_back({y, x%2}), b.push_back({x, y%3});
    }
    sort(a.begin(), a.end()), sort(b.begin(), b.end());
    a.push_back({2e9, 0}), b.push_back({2e9, 0});
    for (int i=0; i<=n; i++) {
        if (i>0 && a[i].first!=a[i-1].first) {
            k+=(db[0]+db[1])%2;
            db[0]=0, db[1]=0;
        }
        db[a[i].second]++;
    }
    db[0]=0, db[1]=0;
    for (int i=0; i<=n; i++) {
        if (i>0 && b[i].first!=b[i-1].first) {
            if (db[0]%2!=db[1]%2 || db[0]%2!=db[2]%2) {
                l++;
            }
            db[0]=0, db[1]=0, db[2]=0;
        }
        db[b[i].second]++;
    }
    ans=max(k, l);
    ans+=(ans+k)%2;
    cout << ans << "\n";
    return 0;
}

Submission Info

Submission Time
Task C - Flipper
User peti1234
Language C++ (GCC 9.2.1)
Score 0
Code Size 966 Byte
Status WA
Exec Time 41 ms
Memory 5132 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1300
Status
AC × 1
AC × 40
WA × 18
Set Name Test Cases
Sample example0.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, 033.txt, 034.txt, 035.txt, 036.txt, 037.txt, 038.txt, 039.txt, 040.txt, 041.txt, 042.txt, 043.txt, 044.txt, 045.txt, 046.txt, 047.txt, 048.txt, 049.txt, 050.txt, 051.txt, 052.txt, 053.txt, 054.txt, 055.txt, 056.txt, example0.txt
Case Name Status Exec Time Memory
000.txt AC 32 ms 4340 KB
001.txt AC 2 ms 3636 KB
002.txt AC 24 ms 4104 KB
003.txt AC 38 ms 4708 KB
004.txt AC 30 ms 4132 KB
005.txt AC 21 ms 3888 KB
006.txt AC 35 ms 4748 KB
007.txt AC 32 ms 4224 KB
008.txt AC 26 ms 4132 KB
009.txt AC 33 ms 4780 KB
010.txt AC 26 ms 4232 KB
011.txt AC 41 ms 4880 KB
012.txt AC 11 ms 3680 KB
013.txt AC 20 ms 4208 KB
014.txt AC 13 ms 3812 KB
015.txt WA 32 ms 4828 KB
016.txt AC 34 ms 4760 KB
017.txt AC 4 ms 3636 KB
018.txt AC 13 ms 3740 KB
019.txt AC 15 ms 3788 KB
020.txt AC 18 ms 4176 KB
021.txt AC 14 ms 3840 KB
022.txt AC 17 ms 4016 KB
023.txt AC 9 ms 3672 KB
024.txt AC 19 ms 4232 KB
025.txt AC 2 ms 3480 KB
026.txt AC 26 ms 4220 KB
027.txt AC 21 ms 4356 KB
028.txt AC 23 ms 4276 KB
029.txt AC 19 ms 4180 KB
030.txt WA 21 ms 4256 KB
031.txt AC 19 ms 4276 KB
032.txt AC 34 ms 5048 KB
033.txt AC 33 ms 5128 KB
034.txt AC 36 ms 4996 KB
035.txt WA 35 ms 5056 KB
036.txt WA 35 ms 5108 KB
037.txt WA 37 ms 5108 KB
038.txt WA 32 ms 5080 KB
039.txt WA 34 ms 5112 KB
040.txt AC 36 ms 4996 KB
041.txt WA 35 ms 5132 KB
042.txt WA 39 ms 5080 KB
043.txt WA 37 ms 5124 KB
044.txt AC 36 ms 5000 KB
045.txt WA 36 ms 5000 KB
046.txt WA 38 ms 5112 KB
047.txt WA 33 ms 4956 KB
048.txt WA 36 ms 5128 KB
049.txt AC 37 ms 5052 KB
050.txt WA 33 ms 5052 KB
051.txt WA 37 ms 4996 KB
052.txt WA 34 ms 5108 KB
053.txt WA 35 ms 4952 KB
054.txt AC 37 ms 5132 KB
055.txt AC 37 ms 5120 KB
056.txt AC 36 ms 5004 KB
example0.txt AC 3 ms 3656 KB