結果
問題 | No.862 XORでX |
ユーザー | LayCurse |
提出日時 | 2019-08-09 21:46:37 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 3,353 bytes |
コンパイル時間 | 1,821 ms |
コンパイル使用メモリ | 201,716 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 11:35:17 |
合計ジャッジ時間 | 3,708 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | AC | 2 ms
5,376 KB |
testcase_12 | AC | 1 ms
5,376 KB |
testcase_13 | AC | 1 ms
5,376 KB |
testcase_14 | AC | 2 ms
5,376 KB |
testcase_15 | AC | 2 ms
5,376 KB |
testcase_16 | AC | 4 ms
5,376 KB |
testcase_17 | AC | 4 ms
5,376 KB |
testcase_18 | AC | 4 ms
5,376 KB |
testcase_19 | AC | 4 ms
5,376 KB |
testcase_20 | AC | 5 ms
5,376 KB |
testcase_21 | AC | 4 ms
5,376 KB |
testcase_22 | AC | 4 ms
5,376 KB |
testcase_23 | AC | 4 ms
5,376 KB |
testcase_24 | AC | 5 ms
5,376 KB |
testcase_25 | AC | 5 ms
5,376 KB |
testcase_26 | AC | 5 ms
5,376 KB |
testcase_27 | AC | 5 ms
5,376 KB |
testcase_28 | AC | 4 ms
5,376 KB |
testcase_29 | AC | 4 ms
5,376 KB |
testcase_30 | AC | 4 ms
5,376 KB |
testcase_31 | AC | 4 ms
5,376 KB |
ソースコード
#include<bits/stdc++.h> using namespace std; inline void rd(int &x){ int k, m=0; x=0; for(;;){ k = getchar_unlocked(); if(k=='-'){ m=1; break; } if('0'<=k&&k<='9'){ x=k-'0'; break; } } for(;;){ k = getchar_unlocked(); if(k<'0'||k>'9'){ break; } x=x*10+k-'0'; } if(m){ x=-x; } } inline void wt_L(char a){ putchar_unlocked(a); } inline void wt_L(int x){ char f[10]; int m=0, s=0; if(x<0){ m=1; x=-x; } while(x){ f[s++]=x%10; x/=10; } if(!s){ f[s++]=0; } if(m){ putchar_unlocked('-'); } while(s--){ putchar_unlocked(f[s]+'0'); } } int N; int X; int res[100000]; int main(){ int i, j, k, m, r; rd(N); rd(X); m = (N-1) / 4; k = 4; r = 0; for(i=0;i<(m);i++){ if(X/4==k/4){ k += 4; } for(j=0;j<(4);j++){ res[r++] = k+j; } k += 4; } if(N%4==0){ if(X==1){ res[r++] = k+1; res[r++] = k+3; res[r++] = 1; res[r++] = 2; } else if(X==2){ res[r++] = k; res[r++] = k+1; res[r++] = 1; res[r++] = 2; } else if(X==3){ res[r++] = k; res[r++] = k+1; res[r++] = 1; res[r++] = 3; } else{ res[r++] = X; res[r++] = 1; res[r++] = 2; res[r++] = 3; } } if(N%4==1){ res[r++] = X; } if(N%4==2){ if(X!=1){ res[r++] = X^1; res[r++] = 1; } else{ res[r++] = 2; res[r++] = 3; } } if(N%4==3){ if(X==1){ res[r++] = 3; res[r++] = k; res[r++] = k+2; } else if(X==2){ res[r++] = 3; res[r++] = k; res[r++] = k+1; } else if(X==3){ res[r++] = 2; res[r++] = k; res[r++] = k+1; } else{ res[r++] = X^1; res[r++] = 2; res[r++] = 3; } } for(i=0;i<(N);i++){ wt_L(res[i]); wt_L('\n'); } return 0; } // cLay varsion 20190806-1 [beta] // --- original code --- // int N, X; // int res[1d5]; // { // int i, j, k, m, r; // rd(N,X); // // m = (N-1) / 4; // k = 4; // r = 0; // rep(i,m){ // if(X/4==k/4) k += 4; // rep(j,4) res[r++] = k+j; // k += 4; // } // // if(N%4==0){ // if(X==1){ // res[r++] = k+1; // res[r++] = k+3; // res[r++] = 1; // res[r++] = 2; // } else if(X==2){ // res[r++] = k; // res[r++] = k+1; // res[r++] = 1; // res[r++] = 2; // } else if(X==3){ // res[r++] = k; // res[r++] = k+1; // res[r++] = 1; // res[r++] = 3; // } else { // res[r++] = X; // res[r++] = 1; // res[r++] = 2; // res[r++] = 3; // } // } // if(N%4==1){ // res[r++] = X; // } // if(N%4==2){ // if(X!=1){ // res[r++] = X^1; // res[r++] = 1; // } else { // res[r++] = 2; // res[r++] = 3; // } // } // if(N%4==3){ // if(X==1){ // res[r++] = 3; // res[r++] = k; // res[r++] = k+2; // } else if(X==2){ // res[r++] = 3; // res[r++] = k; // res[r++] = k+1; // } else if(X==3){ // res[r++] = 2; // res[r++] = k; // res[r++] = k+1; // } else { // res[r++] = X^1; // res[r++] = 2; // res[r++] = 3; // } // } // // rep(i,N) wt(res[i]); // }