Submission #1531052
Source Code Expand
#include <vector> #include <queue> #include <algorithm> #include <iostream> #include <string> #include <ctime> #include <map> #include <stack> #include <sstream> using namespace std; map <pair<long long int, long long int>, int> painted; //색칠된 좌표를 (0,0)으로 해서 그 블락에 몇개나 색칠되어있는지를 체크. int counting(long long int x, long long int y) { int res = 0; for (long long int i = y; i <= y + 2; i++) { for (long long int j = x; j <= x + 2; j++) { if (painted[make_pair(i, j)] == 1) { res += 1; } } } return res; } int main(void) { long long int count[10] = { 0, }; long long int H, W, N; long long int a, b; cin >> H >> W >> N; for (int i = 0; i < N; i++) { cin >> a >> b; painted[make_pair(a,b)] = 1; } //아무것도 색칠되지 않았다고 설정. count[0] = (H - 2)*(W - 2); //블락에 몇개나 색칠되어 있는지 확인. for (auto it = painted.begin(); it != painted.end(); it++) { int res; long long int x = it->first.second; long long int y = it->first.first; if (y > H - 2 || x > W - 2) { continue; } res = counting(x, y); //0이면 안해도 됨. if (res != 0) { count[res] += 1; count[0] -= 1; } } for (int i = 0; i < 10; i++) { cout << count[i] << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Snuke's Coloring |
User | joker_x |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1380 Byte |
Status | WA |
Exec Time | 3171 ms |
Memory | 222592 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status | AC |
|
Set Name | Test Cases |
---|---|
Sample | |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, empty.txt, sample_01.txt, sample_02.txt, sample_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 128 ms | 8064 KB |
02.txt | WA | 1129 ms | 77440 KB |
03.txt | AC | 48 ms | 3328 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | TLE | 3171 ms | 222592 KB |
06.txt | TLE | 3168 ms | 188160 KB |
07.txt | TLE | 3160 ms | 64256 KB |
08.txt | TLE | 3165 ms | 141056 KB |
09.txt | TLE | 3166 ms | 133248 KB |
10.txt | TLE | 3165 ms | 127872 KB |
11.txt | TLE | 3163 ms | 110336 KB |
12.txt | TLE | 3167 ms | 158336 KB |
13.txt | TLE | 3165 ms | 140800 KB |
14.txt | TLE | 3165 ms | 146944 KB |
15.txt | WA | 969 ms | 62848 KB |
empty.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 |