# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
711171 | onlk97 | Red-blue table (IZhO19_stones) | C++14 | 31 ms | 2232 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
void solve(){
int n,m;
cin>>n>>m;
int ans1=-1,rr;
for (int r=0; r<=n; r++){
int cnt=r,req=n/2+1-(n-r);
if (req<=0) cnt+=m;
else {
int L=0,R=m;
while (L<R){
int mid=(L+R+1)/2;
if (r*min(mid,m-m/2-1)>=mid*req) L=mid;
else R=mid-1;
}
cnt+=L;
}
if (cnt>ans1){
ans1=cnt;
rr=r;
}
}
cout<<ans1<<'\n';
int tt=ans1-rr;
char op[n+1][m+1];
for (int i=1; i<=n; i++){
for (int j=1; j<=m; j++) op[i][j]=(i<=rr?'+':'-');
}
if (n-rr<n/2+1){
int ut=min(ans1-rr,m-m/2-1);
for (int j=1; j<=rr; j++){
for (int k=(j-1)*ut; k<j*ut; k++) op[j][k%(ans1-rr)+1]='-';
}
}
for (int i=1; i<=n; i++){
for (int j=1; j<=m; j++) cout<<op[i][j];
cout<<'\n';
}
}
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int t;
cin>>t;
while (t--) solve();
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |