# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
395791 | 2021-04-28T23:17:23 Z | CaroLinda | Red-blue table (IZhO19_stones) | C++14 | 69 ms | 2220 KB |
#include <bits/stdc++.h> #define ll long long #define ff first #define ss second #define all(x) x.begin(),x.end() #define pb push_back #define sz(x) (int)(x.size()) using namespace std ; int T , N , M , K ; int teto(int num, int den) { return (num/den)+( num%den != 0 ) ; } void solve() { scanf("%d %d", &N, &M ) ; K = (N+2)>>1 ; vector<int> freq(N,M) ; vector< vector<char> > grid( N , vector<char>(M,'+') ) ; for(int ans = 1 ; ans <= N+M ; ans++ ) for(int linhas_zoadas = max(0, ans-M) ; linhas_zoadas <= min(N, ans) ; linhas_zoadas++ ) { int colunas_zoadas = ans-linhas_zoadas ; int k_azul = K-linhas_zoadas ; int k_verm = K-colunas_zoadas ; int worst_line = (N-linhas_zoadas) ? teto( k_azul*(M-colunas_zoadas) , N-linhas_zoadas ) : 0 ; if(worst_line*2 >= M) continue ; for(int a = 0 ; a < linhas_zoadas ; a++ ) for(int b = 0 ; b < M ; b++ ) grid[a][b] = '-' ; for(int a = colunas_zoadas , id = linhas_zoadas ; a < M ; a++ ) { int cnt = k_azul ; while(cnt--) { if(id == N) id = linhas_zoadas ; grid[id][a] = '-' ; id++ ; } } printf("%d\n", N+M-ans) ; for(int i = 0 ; i < N ; i++ , printf("\n")) for(int j = 0 ; j < M ; j++ ) printf("%c", grid[i][j] ) ; return ; } } int main() { scanf("%d", &T ) ; while(T--) solve() ; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 2 ms | 332 KB | Output is correct |
4 | Correct | 4 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 66 ms | 1224 KB | Output is correct |
2 | Correct | 60 ms | 1860 KB | Output is correct |
3 | Correct | 56 ms | 1860 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 69 ms | 1220 KB | Output is correct |
2 | Correct | 64 ms | 1368 KB | Output is correct |
3 | Correct | 48 ms | 1348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 2 ms | 332 KB | Output is correct |
4 | Correct | 4 ms | 332 KB | Output is correct |
5 | Correct | 66 ms | 1224 KB | Output is correct |
6 | Correct | 60 ms | 1860 KB | Output is correct |
7 | Correct | 56 ms | 1860 KB | Output is correct |
8 | Correct | 69 ms | 1220 KB | Output is correct |
9 | Correct | 64 ms | 1368 KB | Output is correct |
10 | Correct | 48 ms | 1348 KB | Output is correct |
11 | Correct | 16 ms | 512 KB | Output is correct |
12 | Correct | 53 ms | 1468 KB | Output is correct |
13 | Correct | 55 ms | 1308 KB | Output is correct |
14 | Correct | 49 ms | 1092 KB | Output is correct |
15 | Correct | 67 ms | 2220 KB | Output is correct |
16 | Correct | 47 ms | 1664 KB | Output is correct |
17 | Correct | 21 ms | 844 KB | Output is correct |