QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#22312 | #2351. Lost in Transfer | 1145141919810# | 0 | 0ms | 0kb | C++20 | 3.0kb | 2022-03-09 15:02:30 | 2023-01-17 09:30:52 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef double db;
#define int long long
#define fi first
#define se second
#define mk make_pair
#define pb emplace_back
#define poly vector<int>
#define Bt(a) bitset<a>
#define bc __builtin_popcount
#define pc putchar
#define ci const int&
const int mod = 998244353;
const db eps = 1e-10;
inline int Max(ci x, ci y) {return x > y ? x : y;}
inline int Min(ci x, ci y) {return x < y ? x : y;}
inline db Max(db x, db y) {return x - y > eps ? x : y;}
inline db Min(db x, db y) {return x - y < eps ? x : y;}
inline int Add(ci x, ci y, ci M = mod) {return (x + y) % M;}
inline int Mul(ci x, ci y, ci M = mod) {return 1ll * x * y % M;}
inline int Dec(ci x, ci y, ci M = mod) {return (x - y + M) % M;}
typedef pair<int, int> pii;
inline int Abs(int x) {return x < 0 ? -x : x;}
//char buf[1<<21],*p1=buf,*p2=buf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
char Obuf[105000],*O=Obuf;//Siz shoule be the size of Out File
int pst[30],ptop;
inline void Fprint(){fwrite(Obuf,1,O-Obuf,stdout);}
inline void Fwrite(int x){
if(x==0){*O++='0';if(O-Obuf>100000)Fprint(),O=Obuf;return;}
if(x<0)*O++='-',x=-x;ptop=0;
while(x)pst[++ptop]=x%10,x/=10;
while(ptop)*O++=pst[ptop--]+'0';
if(O-Obuf>100000)Fprint(),O=Obuf;
}
inline int read() {
int s = 0, w = 1;
char ch = getchar();
while (!isdigit(ch)) {if (ch == '-') w = -1;ch = getchar();}
while (isdigit(ch)) {s = s * 10 + ch - '0';ch = getchar();}
return s * w;
}
inline void write(int x) {
if (x < 0)putchar('-'), x = -x;
if (x > 9)write(x / 10);
pc(x % 10 + '0');
}
inline int qpow(int x, int y) {
int res = 1;
while (y) {if (y & 1)res = Mul(res, x);x = Mul(x, x);y >>= 1;}
return res;
}
inline void cadd(int &x, int y) {x += y;}
inline void cmul(int &x, int y) {x *= y;}
inline void cmax(int &x, int y) {x = Max(x, y);}
inline void cmin(int &x, int y) {x = Min(x, y);}
const int N = 3e5 + 10;
namespace Refined_heart{
char s[1000];
int T;
int b[N],a[N];
int c[N];
void transmit(int now){
int n=read();
int v=0;
for(int i=1;i<=n;++i)a[i]=read();
for(int i=1;i<=n;++i)v^=a[i];
for(int i=1;i<=n;++i){
a[i]<<=15;
a[i]|=v;
}
for(int i=1;i<=n;++i)cout<<a[i]<<" ";
pc('\n');
}
void recover(int now){
// puts("???");
int n=read();
for(int i=1;i<=n;++i)b[i]=read();
// puts(">>>");
for(int i=1;i<=n;++i){
c[i]=b[i]>>15;
}
// puts("!!!");
int v=0;
for(int i=1;i<=n;++i)v^=c[i];
int num=b[1]&((1<<15)-1);
if(num==v){
sort(c+1,c+n+1);
for(int i=1;i<=n;++i)cout<<c[i]<<" ";
pc('\n');
return;
}
// puts("!!");
int rest=num^v;
// cout<<rest<<"\n";
++n;
c[n]=rest;
sort(c+1,c+n+1);
for(int i=1;i<=n;++i)cout<<c[i]<<' ';
pc('\n');
// cout<<rest<<"\n";
}
void solve(){
int fg=0;
cin>>s;
if(s[0]=='t')fg=1;
else fg=0;
T=read();
for(int i=1;i<=T;++i){
if(fg)transmit(i);
else recover(i);
}
}
}
signed main(){
Refined_heart::solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
input:
transmit 2 20 97 388 459 467 32 99 98 296 403 325 330 271 87 333 378 267 405 58 426 374 20 125 481 451 150 495 136 444 192 118 26 68 281 120 61 494 339 86 292 100 32
output:
3178623 12714111 15040639 15302783 1048703 3244159 3211391 9699455 13205631 10649727 10813567 8880255 2850943 10911871 12386431 8749183 13271167 1900671 13959295 12255359 4096045 15761453 14778413 4915245 16220205 4456493 14549037 6291501 3866669 852013 2228269 9207853 3932205 1998893 16187437 1110...
input:
output:
result:
wrong answer The sequence your program outputs on the first run is invalid. (test case 1)