제출 #1176215

#제출 시각아이디문제언어결과실행 시간메모리
1176215emil_aliyevvRed-blue table (IZhO19_stones)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>using namespace std;#define maxs(a,b) (a=max(a,b))#define lc id<<1#define rc lc|1#define mid ((l+r)>>1)#define pb push_backint n, m;char ans[1003][1003];int cnt[1003], ord[1003];void Main() {cin >> n >> m;int x=0, y=m;for(int i=1, cur=0; i<=n; i++) {while(cur<m/2+1 && (i*(m/2+1-cur)+m-cur-1)/(m-cur)>n-(n/2+1)) cur++;if(i+m-cur>x+y) x=i, y=m-cur;}for(int i=1; i<=n; i++) fill(ans[i]+1, ans[i]+m+1, '-');for(int j=1; j<=y; j++) cnt[j+m-y]=0, ord[j]=j+m-y;for(int i=1; i<=x; i++) {for(int j=1; j<=m-y; j++)ans[i][j] = '+';sort(ord+1, ord+y+1, [&](int c1, int c2) { return cnt[c1]<cnt[c2]; });for(int j=1; j<=m/2+1-(m-y); j++) {ans[i][ord[j]] = '+';cnt[ord[j]]++;}}cout << x+y << '\n';for(int i=1; i<=n; i++) {for(int j=1; j<=m; j++) cout << ans[i][j];cout << '\n';}}int32_t main() {cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);int T;cin >> T;while(T--) Main();return 0;}

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

stones.cpp:1:30: warning: extra tokens at end of #include directive
    1 | #include<bits/stdc++.h>using namespace std;#define maxs(a,b) (a=max(a,b))#define lc id<<1#define rc lc|1#define mid ((l+r)>>1)#define pb push_backint n, m;char ans[1003][1003];int cnt[1003], ord[1003];void Main() {cin >> n >> m;int x=0, y=m;for(int i=1, cur=0; i<=n; i++) {while(cur<m/2+1 && (i*(m/2+1-cur)+m-cur-1)/(m-cur)>n-(n/2+1)) cur++;if(i+m-cur>x+y) x=i, y=m-cur;}for(int i=1; i<=n; i++) fill(ans[i]+1, ans[i]+m+1, '-');for(int j=1; j<=y; j++) cnt[j+m-y]=0, ord[j]=j+m-y;for(int i=1; i<=x; i++) {for(int j=1; j<=m-y; j++)ans[i][j] = '+';sort(ord+1, ord+y+1, [&](int c1, int c2) { return cnt[c1]<cnt[c2]; });for(int j=1; j<=m/2+1-(m-y); j++) {ans[i][ord[j]] = '+';cnt[ord[j]]++;}}cout << x+y << '\n';for(int i=1; i<=n; i++) {for(int j=1; j<=m; j++) cout << ans[i][j];cout << '\n';}}int32_t main() {cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);int T;cin >> T;while(T--) Main();return 0;}
      |                              ^~~~~~~~~
stones.cpp:1:9: fatal error: bits/stdc++.h>usin: No such file or directory
    1 | #include<bits/stdc++.h>using namespace std;#define maxs(a,b) (a=max(a,b))#define lc id<<1#define rc lc|1#define mid ((l+r)>>1)#define pb push_backint n, m;char ans[1003][1003];int cnt[1003], ord[1003];void Main() {cin >> n >> m;int x=0, y=m;for(int i=1, cur=0; i<=n; i++) {while(cur<m/2+1 && (i*(m/2+1-cur)+m-cur-1)/(m-cur)>n-(n/2+1)) cur++;if(i+m-cur>x+y) x=i, y=m-cur;}for(int i=1; i<=n; i++) fill(ans[i]+1, ans[i]+m+1, '-');for(int j=1; j<=y; j++) cnt[j+m-y]=0, ord[j]=j+m-y;for(int i=1; i<=x; i++) {for(int j=1; j<=m-y; j++)ans[i][j] = '+';sort(ord+1, ord+y+1, [&](int c1, int c2) { return cnt[c1]<cnt[c2]; });for(int j=1; j<=m/2+1-(m-y); j++) {ans[i][ord[j]] = '+';cnt[ord[j]]++;}}cout << x+y << '\n';for(int i=1; i<=n; i++) {for(int j=1; j<=m; j++) cout << ans[i][j];cout << '\n';}}int32_t main() {cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);int T;cin >> T;while(T--) Main();return 0;}
      |         ^~~~~~~~~~~~~~~~~~~~
compilation terminated.