Submission #71673565


Source Code Expand

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace atcoder;
using namespace std;
using ll = long long;
using mint = modint998244353;
#define nl '\n'
#define rep(i, n) for(ll i = 0; i < (ll)(n); ++i)
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
const ll INF = (1LL << 62);
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------

void solve()
{
    int n, m; cin >> n >> m;
    map<pair<ll,ll>, bool> mp;
    int ans = 0;
    rep(i, m)
    {
        ll r, c; cin >> r >> c;
        bool ok = true;
        for(int j = -1; j <= 1; ++j)
        {
            for(int k = -1; k <= 1; ++k)
            {
                if(mp[{r+j, c+k}]) ok = false;
            }
        }
        if(ok)
        {
            mp[{r, c}] = true;
            ans++;
        }
    }
    cout << ans << nl;
}
//--------------------------------------------------------------------------------

int main()
{
    cout << fixed << setprecision(10);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}

Submission Info

Submission Time
Task C - 2x2 Placing
User Sachikosan
Language C++23 (GCC 15.2.0)
Score 300
Code Size 1306 Byte
Status AC
Exec Time 651 ms
Memory 116084 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 36
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 02_random2_09.txt, 02_random2_10.txt, 02_random2_11.txt, 02_random2_12.txt, 02_random2_13.txt, 02_random2_14.txt, 02_random2_15.txt, 03_handmade_00.txt, 03_handmade_01.txt, 03_handmade_02.txt, 03_handmade_03.txt, 03_handmade_04.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3388 KiB
00_sample_01.txt AC 1 ms 3492 KiB
00_sample_02.txt AC 1 ms 3552 KiB
01_random_00.txt AC 11 ms 3564 KiB
01_random_01.txt AC 19 ms 3516 KiB
01_random_02.txt AC 29 ms 3552 KiB
01_random_03.txt AC 132 ms 3808 KiB
01_random_04.txt AC 119 ms 25440 KiB
01_random_05.txt AC 188 ms 5480 KiB
01_random_06.txt AC 352 ms 66932 KiB
01_random_07.txt AC 651 ms 110724 KiB
01_random_08.txt AC 371 ms 59656 KiB
01_random_09.txt AC 639 ms 115592 KiB
01_random_10.txt AC 82 ms 26996 KiB
01_random_11.txt AC 528 ms 115976 KiB
02_random2_00.txt AC 507 ms 116084 KiB
02_random2_01.txt AC 551 ms 115560 KiB
02_random2_02.txt AC 529 ms 114784 KiB
02_random2_03.txt AC 495 ms 113768 KiB
02_random2_04.txt AC 516 ms 112616 KiB
02_random2_05.txt AC 507 ms 111040 KiB
02_random2_06.txt AC 510 ms 108920 KiB
02_random2_07.txt AC 505 ms 106160 KiB
02_random2_08.txt AC 502 ms 102736 KiB
02_random2_09.txt AC 488 ms 97632 KiB
02_random2_10.txt AC 462 ms 90244 KiB
02_random2_11.txt AC 442 ms 81796 KiB
02_random2_12.txt AC 384 ms 68460 KiB
02_random2_13.txt AC 333 ms 52084 KiB
02_random2_14.txt AC 243 ms 30468 KiB
02_random2_15.txt AC 115 ms 3864 KiB
03_handmade_00.txt AC 19 ms 3552 KiB
03_handmade_01.txt AC 275 ms 66056 KiB
03_handmade_02.txt AC 282 ms 66144 KiB
03_handmade_03.txt AC 345 ms 66096 KiB
03_handmade_04.txt AC 348 ms 66052 KiB