Submission #1988893
Source Code Expand
#include<bits/stdc++.h> using namespace std; static const int INF = 1e9 + 7; using pii = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using ll = long long; using ull = unsigned long long; void hawawa() { long long h, w, n; cin >> h >> w >> n; set<pair<int, int> > s; unsigned long long ans[10] = {(h - 2) * (w - 2)}; while (n--) { int a, b; cin >> a >> b; auto status = make_pair(a, b); s.insert(status); short cnt = 0; for (int i = a - 2; i <= a && i + 2 <= h; i++) { if (i <= 0) continue; for (int j = b - 2; j <= b && j + 2 <= w; j++) { if (j <= 0) continue; int cnt = 0; for (int k = 0; k < 3; k++) { for (int l = 0; l < 3; l++) { cnt += s.count(make_pair(i + k, j + l)); } } if (cnt) { ans[cnt - 1]--; } ans[cnt]++; } } } for (auto&& i : ans) { cout << i << "\n"; } } int main() { ios::sync_with_stdio(false); cin.tie(0); hawawa(); }
Submission Info
Submission Time | |
---|---|
Task | D - Snuke's Coloring |
User | stone725 |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1085 Byte |
Status | AC |
Exec Time | 540 ms |
Memory | 4992 KB |
Compile Error
./Main.cpp: In function ‘void hawawa()’: ./Main.cpp:20:41: warning: narrowing conversion of ‘((h + -2ll) * (w + -2ll))’ from ‘long long int’ to ‘long long unsigned int’ inside { } [-Wnarrowing] unsigned long long ans[10] = {(h - 2) * (w - 2)}; ^
Judge Result
Set Name | Sample | All | ||
---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 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 | 540 ms | 4992 KB |
02.txt | AC | 475 ms | 4992 KB |
03.txt | AC | 116 ms | 1408 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 230 ms | 4992 KB |
06.txt | AC | 189 ms | 4992 KB |
07.txt | AC | 360 ms | 4992 KB |
08.txt | AC | 365 ms | 4992 KB |
09.txt | AC | 362 ms | 4992 KB |
10.txt | AC | 1 ms | 256 KB |
11.txt | AC | 483 ms | 4992 KB |
12.txt | AC | 428 ms | 4992 KB |
13.txt | AC | 2 ms | 256 KB |
14.txt | AC | 499 ms | 4992 KB |
15.txt | AC | 484 ms | 4992 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 |