Submission #3238867


Source Code Expand

/**
 *      ABC 47 B
 *      author  : kyomukyomupurin
 *      created : 2018-09-22 13:44:45
**/

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int W, H, N; cin >> W >> H >> N;
    int x[N] = {}; int y[N] = {}; int a[N] = {};
    for (auto i = 0; i < N; ++i) {
        cin >> x[i] >> y[i] >> a[i];
    }
    int s[W][H] = {};
    for (auto i = 0; i < W; ++i) {
        for (auto j = 0; j < H; ++j) {
            s[i][j] = 1;
        }
    }

    for (auto i = 0; i < N; ++i) {
        if (a[i] == 1){
            for (auto j = 0; j < x[i]; ++j) {
                for (auto k = 0; k < H; ++k) {
                    s[j][k] = 0;
                }
            }
        }
        else if (a[i] == 2){
            for (auto j = x[i]; j < W; ++j) {
                for (auto k = 0; k < H; ++k) {
                    s[j][k] = 0;
                }
            }            
        }
        else if (a[i] == 3){
            for (auto j = 0; j < W; ++j) {
                for (auto k = 0; k < y[i]; ++k) {
                    s[j][k] = 0;
                }
            }
        }
        else if (a[i] == 4){
            for (auto j = 0; j < W; ++j) {
                for (auto k = y[i]; k < H; ++k) {
                    s[j][k] = 0;
                }
            }
        }
    }

    int answer = 0;

    for (auto i = 0; i < W; ++i) {
        for (auto j = 0; j < H; ++j) {
            answer += s[i][j];
        }
    }
    cout << answer << endl;

    return 0;
}

Submission Info

Submission Time
Task B - Snuke's Coloring 2 (ABC Edit)
User kyomukyomupurin
Language C++14 (GCC 5.4.1)
Score 200
Code Size 1629 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 13
Set Name Test Cases
sample sample_01.txt, sample_02.txt, sample_03.txt
All dir_01.txt, dir_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, sample_01.txt, sample_02.txt, sample_03.txt, small_01.txt, small_02.txt, small_03.txt, small_04.txt
Case Name Status Exec Time Memory
dir_01.txt AC 1 ms 256 KB
dir_02.txt AC 1 ms 256 KB
random_01.txt AC 1 ms 256 KB
random_02.txt AC 1 ms 256 KB
random_03.txt AC 1 ms 256 KB
random_04.txt AC 1 ms 256 KB
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
small_01.txt AC 1 ms 256 KB
small_02.txt AC 1 ms 256 KB
small_03.txt AC 1 ms 256 KB
small_04.txt AC 1 ms 256 KB