Submission #71667083


Source Code Expand

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;

int dx[4] = {0,1,0,1};
int dy[4] = {0,0,1,1};

int main(){
    int n,m;
    cin >> n >> m;
    int R[m], C[m];
    for(int i = 0; i < m; i++) cin >> R[i] >> C[i];

    set<pair<int, int>> Z;
    for(int i = 0; i < m; i++){
        bool suc = true;
        for(int k = 0; k < 4; k++){
            int x = R[i] + dx[k];
            int y = C[i] + dy[k];
            if(Z.contains({x,y})) suc = false;
        }

        if(suc){
            for(int k = 0; k < 4; k++){
                int x = R[i] + dx[k];
                int y = C[i] + dy[k];
                Z.insert({x,y});
            }
        }
    }

    cout << Z.size() / 4 << endl;
}

Submission Info

Submission Time
Task C - 2x2 Placing
User sakimori_coder
Language C++23 (GCC 15.2.0)
Score 300
Code Size 742 Byte
Status AC
Exec Time 424 ms
Memory 42660 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 3648 KiB
00_sample_01.txt AC 1 ms 3560 KiB
00_sample_02.txt AC 1 ms 3460 KiB
01_random_00.txt AC 17 ms 4160 KiB
01_random_01.txt AC 37 ms 5028 KiB
01_random_02.txt AC 42 ms 4700 KiB
01_random_03.txt AC 96 ms 5156 KiB
01_random_04.txt AC 73 ms 11356 KiB
01_random_05.txt AC 126 ms 6236 KiB
01_random_06.txt AC 221 ms 25612 KiB
01_random_07.txt AC 422 ms 40972 KiB
01_random_08.txt AC 230 ms 23812 KiB
01_random_09.txt AC 424 ms 42340 KiB
01_random_10.txt AC 59 ms 11684 KiB
01_random_11.txt AC 401 ms 42560 KiB
02_random2_00.txt AC 414 ms 42660 KiB
02_random2_01.txt AC 416 ms 42428 KiB
02_random2_02.txt AC 411 ms 42256 KiB
02_random2_03.txt AC 421 ms 41832 KiB
02_random2_04.txt AC 418 ms 41408 KiB
02_random2_05.txt AC 412 ms 41064 KiB
02_random2_06.txt AC 409 ms 40156 KiB
02_random2_07.txt AC 403 ms 39256 KiB
02_random2_08.txt AC 400 ms 38336 KiB
02_random2_09.txt AC 383 ms 36888 KiB
02_random2_10.txt AC 373 ms 34584 KiB
02_random2_11.txt AC 359 ms 31888 KiB
02_random2_12.txt AC 325 ms 27204 KiB
02_random2_13.txt AC 281 ms 21924 KiB
02_random2_14.txt AC 214 ms 14608 KiB
02_random2_15.txt AC 141 ms 5220 KiB
03_handmade_00.txt AC 36 ms 5164 KiB
03_handmade_01.txt AC 183 ms 23872 KiB
03_handmade_02.txt AC 188 ms 23772 KiB
03_handmade_03.txt AC 189 ms 23776 KiB
03_handmade_04.txt AC 160 ms 17688 KiB