結果
問題 | No.110 しましまピラミッド |
ユーザー | NullKara |
提出日時 | 2020-11-23 10:47:27 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,204 bytes |
コンパイル時間 | 1,427 ms |
コンパイル使用メモリ | 167,424 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-30 23:41:23 |
合計ジャッジ時間 | 10,070 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | TLE | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内: main.cpp:9:13: 警告: ‘Nw’ is used uninitialized [-Wuninitialized] 9 | int W[Nw]; | ^ main.cpp:8:9: 備考: ‘Nw’ はここで宣言されています 8 | int Nw; | ^~ main.cpp:11:13: 警告: ‘Nb’ is used uninitialized [-Wuninitialized] 11 | int B[Nb]; | ^ main.cpp:10:9: 備考: ‘Nb’ はここで宣言されています 10 | int Nb; | ^~
ソースコード
#include<bits/stdc++.h> //#include<atcoder/all> using namespace std; //using namespace atcoder; int main(){ int Nw; int W[Nw]; int Nb; int B[Nb]; cin>>Nw; for(int i=0;i<Nw;i++){ cin>>W[i]; } cin>>Nb; for(int i=0;i<Nb;i++){ cin>>B[i]; } sort(W,W+Nw); sort(B,B+Nb); int c1=1; int l=W[Nw-1]; int Widx=Nw-2; int Bidx=Nb-1; while(1){ if(c1%2==1){ if(Bidx<0) break; if(l>B[Bidx]){ l=B[Bidx]; c1++; } Bidx--; } else{ if(Widx<0) break; if(l>W[Widx]){ l=W[Widx]; c1++; } Widx--; } } int c2=1; l=B[Nb-1]; Widx=Nw-1; Bidx=Nb-2; while(1){ if(c1%2==0){ if(Bidx<0) break; if(l>B[Bidx]){ l=B[Bidx]; c2++; } Bidx--; } else{ if(Widx<0) break; if(l>W[Widx]){ l=W[Widx]; c2++; } Widx--; } } cout<<max(c1,c2)<<endl; }