제출 #341831

#제출 시각아이디문제언어결과실행 시간메모리
341831RedhoodRed-blue table (IZhO19_stones)C++14
27 / 100
6 ms1388 KiB
#include<bits/stdc++.h> #define fi first #define se second #define len(x) (int)(x).size() #define pb push_back #define p2(x) (x)*(x) #define all(x) (x).begin() , (x).end() #define mkp make_pair //#pragma GCC optimize("unroll-loops") //#pragma GCC optimize("Ofast") //#pragma GCC optimize("-O3") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using namespace std; typedef long double ld; typedef long long ll; void solve(int n , int m){ /// red okay??? /// lulz pair < int , int > best = {-1 , -1}; int ans = 0; for(int A = 0; A <= n; ++A){ /// lulz int ost = m - (m + 2)/2; int need = max(0 , (n+2)/2 - (n-A)); int B; if(need == 0){ B = m; if(ans < A + B) ans = A + B , best = {A , B}; }else{ B = (A * ost) / need; B = min(B , m); if(ans < A + B) ans = A + B , best = {A , B}; } } /// lulz cout << ans << '\n'; vector<int>column(m); int A = best.fi , B = best.se; int ost = m - (m + 2)/2; int need = max(0 , (n+2)/2 - (n-A)); if(need == 0){ for(int i = 0 ; i < n; ++i){ if(A){ for(int j = 0 ; j < (m+2)/2;++j) cout << '+'; for(int j = (m+2)/2; j < m; ++j) cout << '-'; A--; }else{ for(int j = 0 ; j < m; ++j) cout << '-'; } cout << '\n'; } }else{ // system("pause"); // cout << " YO " << n << ' '<< m << '\n'; // cout << "YO\n"; // cout << A << ' ' << B << '\n'; // cout << ost << ' ' << need << '\n'; for(int i = 0 ; i < n; ++i){ if(A){ /// poses string cur = string(m , '+'); for(int j = (i/need)*ost ; j < (i/need)*ost + ost; ++j){ if(j >= 0 && j < m) cur[j] = '-'; } cout << cur; A--; }else{ for(int j = 0 ; j < m; ++j) cout << '-'; } cout << '\n'; } } } int main(){ ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0); int t; cin >> t; // for(int i = 1; i<=10; ++i) // for(int j = 1; j <= 10; ++j) // solve(i , j); while(t--){ int n ,m ; cin >> n >> m; solve( n , m); } } /* */

컴파일 시 표준 에러 (stderr) 메시지

stones.cpp: In function 'void solve(int, int)':
stones.cpp:46:23: warning: unused variable 'B' [-Wunused-variable]
   46 |     int A = best.fi , B = best.se;
      |                       ^
#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...