Submission #1127897

#TimeUsernameProblemLanguageResultExecution timeMemory
1127897vusalRed-blue table (IZhO19_stones)C++20
27 / 100
3 ms1348 KiB
//mubarizvusal #include <bits/stdc++.h> using namespace std; typedef long long ll; #define allr(v) v.rbegin(), v.rend() #define all(v) v.begin(), v.end() #define mcqueen ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #define pii pair<int,int> #define pb push_back #define new int32_t #define ts to_string #define fi first #define se second #define ins insert #define int ll #define kub(i) i*i*i new main(){ mcqueen int T; cin >> T; while(T--){ int N, M; cin >> N >> M; int A1 = N; int B1 = 0; int val1 = A1 + B1; // = N int A2 = 0; int B2 = M; int val2 = A2 + B2; // = M int c = (M-1)/2; int A3 = N; int B3 = c; int val3 = A3 + B3; // = N + c int r = (N-1)/2; int A4 = r; int B4 = M; int val4 = A4 + B4; // = r + M int bestVal = val1; int strategy = 1; if(val2 > bestVal) { bestVal = val2; strategy = 2; } if(val3 > bestVal) { bestVal = val3; strategy = 3; } if(val4 > bestVal) { bestVal = val4; strategy = 4; } cout << bestVal << "\n"; if(strategy == 1){ for(int i=0; i<N; i++){ for(int j=0; j<M; j++) cout << '+'; cout << "\n"; } } else if(strategy == 2){ for(int i=0; i<N; i++){ for(int j=0; j<M; j++) cout << '-'; cout << "\n"; } } else if(strategy == 3){ vector<string> grid(N, string(M, '+')); for(int col=0; col<c; col++){ for(int i=0; i<N; i++){ grid[i][col] = '-'; } } for(int i=0; i<N; i++) cout << grid[i] << "\n"; } else { vector<string> grid(N, string(M, '-')); for(int row=0; row<r; row++){ for(int j=0; j<M; j++){ grid[row][j] = '+'; } } for(int i=0; i<N; i++) cout << grid[i] << "\n"; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...