# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
490791 | 2021-11-29T09:23:26 Z | Ziyoda | Red-blue table (IZhO19_stones) | C++14 | 138 ms | 3268 KB |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while(t--){ int n, m, n1, m1; cin >> n >> m; n1 = n; m1 = m;//bool swa=0; if(n1>m1) swap(n1, m1); int e = (n1-1)/2, mn = 0, mns = m1, h = m1/2+1, s=0; string a[n1]; map<int, int> mpc; map<int, int> mpr; int mxx=0; for(int i=0; i<n1; i++){ int mx = mxx, h1=h; for(int j=0; j<m1; j++){ if(mpc[j]<e){ if(h1!=0){ if((m1-j)==h1 || mpc[j]<mx) a[i]+='+', h1--,mpc[j]++,mpr[i]++; else a[i]+='-'; } else{ a[i]+='-'; } } else{ a[i]+='-'; } mxx=max(mxx, mpc[j]); } } for(int i=0; i<n; i++) if(mpr[i]==h) s++; cout << s+m1 << "\n"; if(n==n1) for(int i=0; i<n; i++) cout << a[i] << "\n"; else{ for(int i=0; i<m1; i++){ for(int j=0; j<n1; j++) if(a[j][i]=='-') cout << '+'; else cout << '-'; cout << "\n"; } } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 308 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 308 KB | Output is correct |
3 | Correct | 3 ms | 332 KB | Output is correct |
4 | Correct | 4 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 81 ms | 1268 KB | Output is correct |
2 | Correct | 131 ms | 2008 KB | Output is correct |
3 | Correct | 138 ms | 1992 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 70 ms | 1288 KB | Output is correct |
2 | Correct | 99 ms | 1780 KB | Output is correct |
3 | Correct | 93 ms | 1620 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 308 KB | Output is correct |
3 | Correct | 3 ms | 332 KB | Output is correct |
4 | Correct | 4 ms | 332 KB | Output is correct |
5 | Correct | 81 ms | 1268 KB | Output is correct |
6 | Correct | 131 ms | 2008 KB | Output is correct |
7 | Correct | 138 ms | 1992 KB | Output is correct |
8 | Correct | 70 ms | 1288 KB | Output is correct |
9 | Correct | 99 ms | 1780 KB | Output is correct |
10 | Correct | 93 ms | 1620 KB | Output is correct |
11 | Correct | 14 ms | 460 KB | Output is correct |
12 | Correct | 119 ms | 1652 KB | Output is correct |
13 | Correct | 122 ms | 1548 KB | Output is correct |
14 | Correct | 87 ms | 1200 KB | Output is correct |
15 | Correct | 134 ms | 3268 KB | Output is correct |
16 | Correct | 105 ms | 1784 KB | Output is correct |
17 | Correct | 55 ms | 1144 KB | Output is correct |