QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#22355 | #2351. Lost in Transfer | 1145141919810# | 0 | 0ms | 0kb | C++20 | 3.2kb | 2022-03-09 16:01:50 | 2023-01-17 09:33:11 |
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&
#define ff fflush(stdout)
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]<<=10;
a[i]|=v;
a[i]<<=10;
a[i]|=n;
}
for(int i=1;i<=n;++i)cout<<a[i]<<" ";
pc('\n');
}
void recover(int now){
int n=read();
for(int i=1;i<=n;++i)b[i]=read();
int length=b[1]&((1<<10)-1);
if(length==n){
for(int i=1;i<=n;++i)c[i]=(b[i]>>20);
sort(c+1,c+n+1);
for(int i=1;i<=n;++i){
cout<<c[i]<<" ";
}
cout<<'\n';
return;
}
for(int i=1;i<=n;++i)b[i]>>=10;
for(int i=1;i<=n;++i){c[i]=b[i]>>10;}
int v=0;
for(int i=1;i<=n;++i)v^=c[i];
int num=b[1]&((1<<10)-1);
int rest=num^v;
++n;
c[n]=rest;
sort(c+1,c+n+1);
for(int i=1;i<=n;++i)cout<<c[i]<<' ';
pc('\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){
for(int k=1;k<=1000;++k)a[k]=b[k]=c[k]=0;
if(fg)transmit(i);
else recover(i);
// ff;
}
}
}
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:
101841940 406977556 481426452 489815060 33684500 103939092 102890516 310508564 422706196 340917268 346160148 284294164 91356180 349305876 396491796 280099860 424803348 60947476 446823444 392297492 131118100 504411156 472953876 157332500 519091220 142652436 465613844 201372692 123778068 27309076 713...
input:
output:
result:
wrong answer The sequence your program outputs on the first run is invalid. (test case 1)