Submission #65802029
Source Code Expand
#include <bits/stdc++.h>
using namespace std; using ll = long long;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
using pi = pair<int,int>;
using pl = pair<ll,ll>;
const ll mod = 998244353;
signed main(void){
int h, w, n;
cin >> h >> w >> n;
vector<vector<int> > grid(h, vector<int>(w, 0));
vector<int> a(n);
for(int i = 0; i < n; i++){
cin >> a[i];
}
int x = 0, y = 0;
for(int i = 0; i < n; i++){
for(int j = 0; j < a[i]; j++){
grid[y][x] = i + 1;
cerr << grid[y][x] << endl;
x++;
if(x == w){
x = 0; y++;
}
}
}
for(int i = 0; i < h; i++){
if(i % 2 == 1){
reverse(all(grid[i]));
}
}
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
cout << grid[i][j] << " ";
}
cout << endl;
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - Grid Coloring |
| User | karaju |
| Language | C++ 23 (gcc 12.2) |
| Score | 400 |
| Code Size | 961 Byte |
| Status | AC |
| Exec Time | 22 ms |
| Memory | 3748 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 0_00.txt, 0_01.txt, 0_02.txt |
| All | 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 0_00.txt | AC | 1 ms | 3600 KiB |
| 0_01.txt | AC | 1 ms | 3504 KiB |
| 0_02.txt | AC | 1 ms | 3556 KiB |
| 1_00.txt | AC | 1 ms | 3596 KiB |
| 1_01.txt | AC | 1 ms | 3660 KiB |
| 1_02.txt | AC | 1 ms | 3548 KiB |
| 1_03.txt | AC | 20 ms | 3600 KiB |
| 1_04.txt | AC | 21 ms | 3664 KiB |
| 1_05.txt | AC | 22 ms | 3664 KiB |
| 1_06.txt | AC | 18 ms | 3600 KiB |
| 1_07.txt | AC | 2 ms | 3596 KiB |
| 1_08.txt | AC | 2 ms | 3564 KiB |
| 1_09.txt | AC | 3 ms | 3476 KiB |
| 1_10.txt | AC | 1 ms | 3604 KiB |
| 1_11.txt | AC | 1 ms | 3532 KiB |
| 1_12.txt | AC | 1 ms | 3484 KiB |
| 1_13.txt | AC | 20 ms | 3728 KiB |
| 1_14.txt | AC | 1 ms | 3608 KiB |
| 1_15.txt | AC | 3 ms | 3676 KiB |
| 1_16.txt | AC | 1 ms | 3672 KiB |
| 1_17.txt | AC | 16 ms | 3708 KiB |
| 1_18.txt | AC | 4 ms | 3544 KiB |
| 1_19.txt | AC | 4 ms | 3472 KiB |
| 1_20.txt | AC | 1 ms | 3748 KiB |
| 1_21.txt | AC | 2 ms | 3600 KiB |