結果
問題 | No.1589 Bit Vector |
ユーザー | LayCurse |
提出日時 | 2021-07-08 22:52:22 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,616 bytes |
コンパイル時間 | 3,097 ms |
コンパイル使用メモリ | 228,336 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-01 13:01:56 |
合計ジャッジ時間 | 10,261 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 2 ms
5,376 KB |
testcase_26 | AC | 3 ms
5,376 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
ソースコード
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("inline") #include<bits/stdc++.h> using namespace std; inline int my_getchar_unlocked(){ static char buf[1048576]; static int s = 1048576; static int e = 1048576; if(s == e && e == 1048576){ e = fread_unlocked(buf, 1, 1048576, stdin); s = 0; } if(s == e){ return EOF; } return buf[s++]; } inline void rd(int &x){ int k; int m=0; x=0; for(;;){ k = my_getchar_unlocked(); if(k=='-'){ m=1; break; } if('0'<=k&&k<='9'){ x=k-'0'; break; } } for(;;){ k = my_getchar_unlocked(); if(k<'0'||k>'9'){ break; } x=x*10+k-'0'; } if(m){ x=-x; } } struct MY_WRITER{ char buf[1048576]; int s; int e; MY_WRITER(){ s = 0; e = 1048576; } ~MY_WRITER(){ if(s){ fwrite_unlocked(buf, 1, s, stdout); } } } ; MY_WRITER MY_WRITER_VAR; void my_putchar_unlocked(int a){ if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){ fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout); MY_WRITER_VAR.s = 0; } MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a; } inline void wt_L(char a){ my_putchar_unlocked(a); } inline void wt_L(int x){ int s=0; int m=0; char f[10]; if(x<0){ m=1; x=-x; } while(x){ f[s++]=x%10; x/=10; } if(!s){ f[s++]=0; } if(m){ my_putchar_unlocked('-'); } while(s--){ my_putchar_unlocked(f[s]+'0'); } } inline void wt_L(const char c[]){ int i=0; for(i=0;c[i]!='\0';i++){ my_putchar_unlocked(c[i]); } } template<class S> inline void arrInsert(const int k, int &sz, S a[], const S aval){ int i; sz++; for(i=sz-1;i>k;i--){ a[i] = a[i-1]; } a[k] = aval; } template<class S, class T> inline void arrInsert(const int k, int &sz, S a[], const S aval, T b[], const T bval){ int i; sz++; for(i=sz-1;i>k;i--){ a[i] = a[i-1]; } for(i=sz-1;i>k;i--){ b[i] = b[i-1]; } a[k] = aval; b[k] = bval; } template<class S, class T, class U> inline void arrInsert(const int k, int &sz, S a[], const S aval, T b[], const T bval, U c[], const U cval){ int i; sz++; for(i=sz-1;i>k;i--){ a[i] = a[i-1]; } for(i=sz-1;i>k;i--){ b[i] = b[i-1]; } for(i=sz-1;i>k;i--){ c[i] = c[i-1]; } a[k] = aval; b[k] = bval; c[k] = cval; } template<class S, class T, class U, class V> inline void arrInsert(const int k, int &sz, S a[], const S aval, T b[], const T bval, U c[], const U cval, V d[], const V dval){ int i; sz++; for(i=sz-1;i>k;i--){ a[i] = a[i-1]; } for(i=sz-1;i>k;i--){ b[i] = b[i-1]; } for(i=sz-1;i>k;i--){ c[i] = c[i-1]; } for(i=sz-1;i>k;i--){ d[i] = d[i-1]; } a[k] = aval; b[k] = bval; c[k] = cval; d[k] = dval; } int N; int K; int ress; int resT[100000]; int res1[100000]; int res2[100000]; int res3[100000]; const char*buf[4] = {"", "UPD", "AND", "XOR"}; int main(){ int i, k; rd(N); rd(K); for(k=(0);k<(N);k++){ int i; for(i=(1);i<(N-k);i++){ arrInsert(ress, ress, resT, 1, res1, N, res2, 0); arrInsert(ress, ress, resT, 3, res1, N, res2, N, res3, i-1); arrInsert(ress, ress, resT, 2, res1, N, res2, N, res3, i); arrInsert(ress, ress, resT, 3, res1, N, res2, N, res3, i); arrInsert(ress, ress, resT, 3, res1, i-1, res2, i-1, res3, N); arrInsert(ress, ress, resT, 3, res1, i, res2, i, res3, N); } } wt_L(ress); wt_L('\n'); for(i=(0);i<(ress);i++){ if(resT[i]==1){ wt_L(buf[resT[i]]); wt_L(' '); wt_L(res1[i]); wt_L(' '); wt_L(res2[i]); wt_L('\n'); } else{ wt_L(buf[resT[i]]); wt_L(' '); wt_L(res1[i]); wt_L(' '); wt_L(res2[i]); wt_L(' '); wt_L(res3[i]); wt_L('\n'); } } return 0; } // cLay version 20210708-1 // --- original code --- // int N, K; // int ress, resT[1d5], res1[], res2[], res3[]; // const char *buf[4] = {"", "UPD", "AND", "XOR"}; // { // rd(N,K); // rep(k,N) rep(i,1,N-k){ // arrInsert(ress, ress, resT, 1, res1, N, res2, 0); // arrInsert(ress, ress, resT, 3, res1, N, res2, N, res3, i-1); // arrInsert(ress, ress, resT, 2, res1, N, res2, N, res3, i); // arrInsert(ress, ress, resT, 3, res1, N, res2, N, res3, i); // arrInsert(ress, ress, resT, 3, res1, i-1, res2, i-1, res3, N); // arrInsert(ress, ress, resT, 3, res1, i, res2, i, res3, N); // } // wt(ress); // rep(i,ress){ // if(resT[i]==1) wt(buf[resT[i]], res1[i], res2[i]); // else wt(buf[resT[i]], res1[i], res2[i], res3[i]); // } // }