Submission #00057
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | #include<bits/stdc++.h> using namespace std; #define ll long long struct seg{ ll n,inf = LONG_LONG_MAX; vector<ll> v_sum; seg( int size){ n = 1; while (n < size){ n *= 2; } v_sum.resize(n*2); for ( int i = 0;i < n*2;i++){ v_sum[i] = 0; } } void update( int i, int x){ i += n-1; v_sum[i] = x; while (i > 0){ i = (i-1)/2; v_sum[i] = v_sum[i*2+1] + v_sum[i*2+2]; } } int getsum( int a, int b){ return gettot(a,b,0,0,n); } int gettot( int a, int b, int i, int l, int r){ if (r <= a||b <= l){ return (0); } else if (a <= l&&r <= b){ return v_sum[i]; } else { ll sum_l = gettot(a,b,i*2+1,l,(l+r)/2); ll sum_r = gettot(a,b,i*2+1,(l+r)/2,r); return (sum_l + sum_r); } } }; int main(){ ll h,w; cin>>h>>w; seg seg(w); if (w == 1){ cout<< "0\n" ; return (0); } for ( int i = 0;i < w;i++){ int a; cin>>a; seg.update(i,a); } ll ans = 0; for (ll bit = 0;bit < (1<<w);bit++){ ll r = 0,a=0; bool s = true ,la = false ; for (ll i = 0;i < w;i++){ if (bit&(1 << i)){ if (r == 0){ a = seg.getsum(0,i); r = i+1; //cout<<i<<" "; } else { if (a == seg.getsum(r,i)){ r = i+1; //cout<<i<<" "; } else { s = false ; break ; } if (i == w-1) la = true ; } } } if (la == false ){ if (a == seg.getsum(r,w)){ } else { s = false ; } } //cout<<endl; if (s == true ) ans++; } cout<<ans<<endl; } |
ステータス
項目 | データ |
---|---|
問題 | 0003 - 国土分割 |
ユーザー名 | r2213 |
投稿日時 | 2022-12-08 17:46:46 |
言語 | C++17 |
状態 | Wrong Answer |
得点 | 0 |
ソースコード長 | 2080 Byte |
最大実行時間 | 1000 ms |
最大メモリ使用量 | 1364 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | task1 | 0 / 100 | 01-* |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
01-01.txt | WA | 19 ms | 604 KB |
1
|
01-02.txt | WA | 19 ms | 580 KB |
1
|
01-03.txt | WA | 19 ms | 552 KB |
1
|
01-04.txt | WA | 21 ms | 656 KB |
1
|
01-05.txt | WA | 90 ms | 628 KB |
1
|
01-06.txt | TLE | 1000 ms | 476 KB |
1
|
01-07.txt | WA | 23 ms | 580 KB |
1
|
01-08.txt | WA | 38 ms | 544 KB |
1
|
01-09.txt | WA | 44 ms | 512 KB |
1
|
01-10.txt | WA | 17 ms | 480 KB |
1
|
01-11.txt | AC | 19 ms | 448 KB |
1
|
01-12.txt | AC | 26 ms | 424 KB |
1
|
01-13.txt | WA | 24 ms | 520 KB |
1
|
01-14.txt | WA | 25 ms | 488 KB |
1
|
01-15.txt | AC | 33 ms | 584 KB |
1
|
01-16.txt | WA | 42 ms | 680 KB |
1
|
01-17.txt | AC | 52 ms | 652 KB |
1
|
01-18.txt | WA | 45 ms | 492 KB |
1
|
01-19.txt | WA | 22 ms | 588 KB |
1
|
01-20.txt | WA | 18 ms | 564 KB |
1
|
01-21.txt | TLE | 1000 ms | 536 KB |
1
|
01-22.txt | AC | 21 ms | 512 KB |
1
|
01-23.txt | WA | 49 ms | 484 KB |
1
|
01-24.txt | WA | 21 ms | 580 KB |
1
|
01-25.txt | WA | 23 ms | 556 KB |
1
|
01-26.txt | TLE | 1000 ms | 524 KB |
1
|
01-27.txt | AC | 27 ms | 624 KB |
1
|
01-28.txt | AC | 54 ms | 464 KB |
1
|
01-29.txt | WA | 15 ms | 564 KB |
1
|
01-30.txt | WA | 18 ms | 536 KB |
1
|
01-31.txt | WA | 29 ms | 504 KB |
1
|
01-32.txt | AC | 33 ms | 608 KB |
1
|
01-33.txt | WA | 22 ms | 704 KB |
1
|
01-34.txt | AC | 22 ms | 680 KB |
1
|
01-35.txt | WA | 31 ms | 652 KB |
1
|
01-36.txt | WA | 41 ms | 624 KB |
1
|
01-37.txt | AC | 25 ms | 720 KB |
1
|
01-38.txt | WA | 22 ms | 688 KB |
1
|
01-39.txt | AC | 52 ms | 524 KB |
1
|
01-40.txt | WA | 19 ms | 496 KB |
1
|
01-41.txt | AC | 26 ms | 596 KB |
1
|
01-42.txt | AC | 41 ms | 560 KB |
1
|
01-43.txt | WA | 24 ms | 660 KB |
1
|
01-44.txt | WA | 23 ms | 624 KB |
1
|
01-45.txt | AC | 23 ms | 596 KB |
1
|
01-46.txt | WA | 43 ms | 692 KB |
1
|
01-47.txt | WA | 51 ms | 784 KB |
1
|
01-48.txt | WA | 41 ms | 624 KB |
1
|
02-01.txt | WA | 21 ms | 720 KB | |
02-02.txt | WA | 21 ms | 692 KB | |
02-03.txt | WA | 22 ms | 668 KB | |
02-04.txt | WA | 23 ms | 636 KB | |
02-05.txt | WA | 33 ms | 736 KB | |
02-06.txt | WA | 18 ms | 576 KB | |
02-07.txt | WA | 18 ms | 548 KB | |
02-08.txt | WA | 22 ms | 648 KB | |
02-09.txt | WA | 17 ms | 624 KB | |
02-10.txt | WA | 28 ms | 728 KB | |
02-11.txt | WA | 21 ms | 700 KB | |
02-12.txt | WA | 22 ms | 668 KB | |
02-13.txt | WA | 22 ms | 764 KB | |
02-14.txt | WA | 18 ms | 860 KB | |
02-15.txt | WA | 23 ms | 708 KB | |
02-16.txt | WA | 17 ms | 812 KB | |
02-17.txt | WA | 24 ms | 784 KB | |
02-18.txt | WA | 20 ms | 760 KB | |
02-19.txt | WA | 16 ms | 860 KB | |
02-20.txt | WA | 20 ms | 832 KB | |
02-21.txt | WA | 22 ms | 804 KB | |
02-22.txt | WA | 22 ms | 648 KB | |
02-23.txt | WA | 31 ms | 748 KB | |
02-24.txt | WA | 24 ms | 844 KB | |
02-25.txt | WA | 21 ms | 816 KB | |
02-26.txt | WA | 19 ms | 788 KB | |
02-27.txt | WA | 18 ms | 892 KB | |
02-28.txt | WA | 25 ms | 736 KB | |
02-29.txt | WA | 22 ms | 832 KB | |
02-30.txt | WA | 27 ms | 800 KB | |
02-31.txt | WA | 25 ms | 776 KB | |
02-32.txt | WA | 27 ms | 876 KB | |
02-33.txt | WA | 19 ms | 852 KB | |
02-34.txt | WA | 23 ms | 824 KB | |
02-35.txt | WA | 18 ms | 924 KB | |
02-36.txt | WA | 21 ms | 768 KB | |
02-37.txt | WA | 18 ms | 744 KB | |
02-38.txt | WA | 23 ms | 844 KB | |
02-39.txt | WA | 19 ms | 820 KB | |
02-40.txt | WA | 19 ms | 788 KB | |
02-41.txt | WA | 21 ms | 888 KB | |
02-42.txt | WA | 22 ms | 728 KB | |
02-43.txt | WA | 22 ms | 704 KB | |
02-44.txt | WA | 23 ms | 800 KB | |
02-45.txt | WA | 20 ms | 776 KB | |
02-46.txt | WA | 24 ms | 748 KB | |
02-47.txt | WA | 19 ms | 980 KB | |
02-48.txt | WA | 20 ms | 828 KB | |
02-49.txt | WA | 24 ms | 800 KB | |
02-50.txt | WA | 20 ms | 896 KB | |
02-51.txt | WA | 26 ms | 872 KB | |
02-52.txt | WA | 18 ms | 968 KB | |
02-53.txt | WA | 20 ms | 1072 KB | |
02-54.txt | WA | 17 ms | 912 KB | |
02-55.txt | WA | 19 ms | 884 KB | |
02-56.txt | WA | 20 ms | 984 KB | |
02-57.txt | WA | 22 ms | 832 KB | |
02-58.txt | WA | 20 ms | 808 KB | |
02-59.txt | WA | 18 ms | 908 KB | |
02-60.txt | WA | 20 ms | 1000 KB | |
02-61.txt | WA | 20 ms | 972 KB | |
02-62.txt | WA | 20 ms | 808 KB | |
02-63.txt | WA | 20 ms | 904 KB | |
02-64.txt | WA | 24 ms | 880 KB | |
02-65.txt | WA | 26 ms | 1108 KB | |
02-66.txt | WA | 17 ms | 952 KB | |
02-67.txt | WA | 22 ms | 788 KB | |
02-68.txt | WA | 23 ms | 884 KB | |
02-69.txt | WA | 19 ms | 852 KB | |
02-70.txt | WA | 23 ms | 952 KB | |
02-71.txt | WA | 20 ms | 1056 KB | |
02-72.txt | WA | 25 ms | 904 KB | |
02-73.txt | WA | 21 ms | 1004 KB | |
02-74.txt | WA | 18 ms | 972 KB | |
02-75.txt | WA | 16 ms | 948 KB | |
02-76.txt | WA | 22 ms | 924 KB | |
02-77.txt | WA | 23 ms | 1020 KB | |
02-78.txt | WA | 19 ms | 996 KB | |
02-79.txt | WA | 19 ms | 1096 KB | |
03-01.txt | WA | 22 ms | 1060 KB | |
03-02.txt | WA | 42 ms | 1156 KB | |
03-03.txt | WA | 23 ms | 996 KB | |
03-04.txt | WA | 23 ms | 972 KB | |
03-05.txt | WA | 21 ms | 1068 KB | |
03-06.txt | WA | 55 ms | 916 KB | |
03-07.txt | WA | 21 ms | 1012 KB | |
03-08.txt | WA | 43 ms | 1108 KB | |
03-09.txt | WA | 47 ms | 1200 KB | |
03-10.txt | WA | 29 ms | 1172 KB | |
03-11.txt | WA | 41 ms | 1016 KB | |
03-12.txt | WA | 18 ms | 1112 KB | |
03-13.txt | WA | 92 ms | 1084 KB | |
03-14.txt | WA | 23 ms | 1060 KB | |
03-15.txt | WA | 47 ms | 1028 KB | |
03-16.txt | WA | 28 ms | 1124 KB | |
03-17.txt | WA | 44 ms | 1092 KB | |
03-18.txt | WA | 43 ms | 1060 KB | |
03-19.txt | WA | 53 ms | 1028 KB | |
03-20.txt | WA | 47 ms | 988 KB | |
03-21.txt | WA | 25 ms | 1088 KB | |
03-22.txt | WA | 26 ms | 1188 KB | |
03-23.txt | WA | 41 ms | 1160 KB | |
03-24.txt | WA | 41 ms | 1128 KB | |
03-25.txt | WA | 24 ms | 1220 KB | |
03-26.txt | WA | 41 ms | 1064 KB | |
03-27.txt | WA | 44 ms | 1028 KB | |
03-28.txt | WA | 30 ms | 996 KB | |
03-29.txt | WA | 21 ms | 1092 KB | |
03-30.txt | WA | 50 ms | 1060 KB | |
03-31.txt | WA | 42 ms | 1028 KB | |
03-32.txt | WA | 28 ms | 1000 KB | |
03-33.txt | WA | 34 ms | 1228 KB | |
03-34.txt | WA | 18 ms | 1196 KB | |
03-35.txt | WA | 53 ms | 1040 KB | |
03-36.txt | WA | 39 ms | 1012 KB | |
03-37.txt | WA | 31 ms | 1100 KB | |
03-38.txt | WA | 46 ms | 1196 KB | |
03-39.txt | WA | 47 ms | 1160 KB | |
03-40.txt | WA | 33 ms | 1256 KB | |
03-41.txt | WA | 29 ms | 1100 KB | |
03-42.txt | WA | 48 ms | 1196 KB | |
03-43.txt | WA | 37 ms | 1164 KB | |
03-44.txt | WA | 25 ms | 1260 KB | |
03-45.txt | WA | 22 ms | 1096 KB | |
03-46.txt | WA | 26 ms | 1192 KB | |
03-47.txt | WA | 25 ms | 1160 KB | |
03-48.txt | WA | 308 ms | 1256 KB | |
03-49.txt | WA | 21 ms | 1228 KB | |
03-50.txt | WA | 20 ms | 1200 KB | |
03-51.txt | WA | 20 ms | 1300 KB | |
03-52.txt | WA | 23 ms | 1148 KB | |
03-53.txt | WA | 46 ms | 1120 KB | |
03-54.txt | WA | 48 ms | 1216 KB | |
03-55.txt | WA | 28 ms | 1316 KB | |
03-56.txt | WA | 24 ms | 1160 KB | |
03-57.txt | WA | 70 ms | 1260 KB | |
03-58.txt | WA | 24 ms | 1228 KB | |
03-59.txt | WA | 34 ms | 1204 KB | |
03-60.txt | WA | 323 ms | 1172 KB | |
03-61.txt | WA | 31 ms | 1272 KB | |
03-62.txt | WA | 17 ms | 1236 KB | |
03-63.txt | WA | 18 ms | 1328 KB | |
03-64.txt | WA | 24 ms | 1300 KB | |
03-65.txt | WA | 32 ms | 1272 KB | |
03-66.txt | WA | 42 ms | 1244 KB | |
03-67.txt | WA | 24 ms | 1208 KB | |
03-68.txt | WA | 33 ms | 1300 KB | |
03-69.txt | WA | 35 ms | 1268 KB | |
03-70.txt | WA | 38 ms | 1364 KB | |
03-71.txt | WA | 40 ms | 1332 KB | |
03-72.txt | WA | 43 ms | 1304 KB | |
03-73.txt | WA | 43 ms | 1272 KB | |
03-74.txt | WA | 47 ms | 1240 KB | |
03-75.txt | WA | 48 ms | 1212 KB | |
sample-01.txt | WA | 23 ms | 1184 KB | |
sample-02.txt | WA | 16 ms | 1284 KB | |
sample-03.txt | WA | 16 ms | 1256 KB | |
sample-04.txt | WA | 21 ms | 1356 KB |