QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#322953 | #2351. Lost in Transfer | tuanlinh123 | 0 | 4ms | 5772kb | C++20 | 1.3kb | 2024-02-08 01:24:08 | 2024-02-08 01:24:08 |
answer
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;
ll role[501][501];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
for (ll i=1; i<=500; i++)
for (ll j=1; j<i; j++)
role[i][j]=1<<((i+j)%9);
auto transmit=[&]()
{
ll n, sum=0; cin >> n;
vector <ll> a(n);
for (ll& i:a) cin >> i, sum^=i;
sort(a.begin(), a.end());
for (ll i=0; i<n; i++)
for (ll pos=i; pos; pos--)
{
if (sum&role[a[pos]][a[pos-1]]) swap(a[pos], a[pos-1]);
else break;
}
for (ll i:a) cout << i << " "; cout << "\n";
};
auto recover=[&]()
{
ll n, Max=0, s=0, sn=0; cin >> n;
vector <ll> ans(n);
for (ll &i:ans) cin >> i, s^=i;
for (ll i=0; i<n; i++)
for (ll j=0; j<i; j++)
sn|=role[ans[j]][ans[i]];
s^=sn; if (s) ans.pb(s);
for (ll i:ans) cout << i << " ";
cout << "\n";
};
string type; cin >> type;
ll t; cin >> t;
while (t--)
{
if (type=="transmit") transmit();
else recover();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 5552kb
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:
374 267 98 97 99 296 378 333 87 325 271 330 388 403 459 405 467 58 32 426 26 61 32 68 86 125 118 100 120 136 192 150 281 494 292 444 339 481 451 495
input:
recover 2 19 374 267 98 97 99 296 378 333 87 325 271 330 388 403 459 405 467 58 32 19 26 61 32 68 125 118 100 120 136 192 150 281 494 292 444 339 481 451 495
output:
374 267 98 97 99 296 378 333 87 325 271 330 388 403 459 405 467 58 32 426 26 61 32 68 125 118 100 120 136 192 150 281 494 292 444 339 481 451 495 86
result:
ok all correct (2 test cases)
Test #2:
score: 100
Accepted
time: 2ms
memory: 5772kb
input:
transmit 1 20 158 220 174 224 137 134 339 175 147 122 480 26 151 266 474 144 451 301 105 188
output:
26 105 122 134 137 144 147 151 158 174 175 188 220 224 266 301 339 451 474 480
input:
recover 1 19 26 105 122 134 137 144 147 151 158 174 175 188 220 224 266 301 339 451 474
output:
26 105 122 134 137 144 147 151 158 174 175 188 220 224 266 301 339 451 474 480
result:
ok all correct (1 test case)
Test #3:
score: 100
Accepted
time: 2ms
memory: 5492kb
input:
transmit 1 100 170 478 377 395 397 329 488 424 11 337 249 156 489 244 386 400 81 195 264 272 491 24 280 422 365 382 354 91 23 148 469 196 287 191 368 436 132 84 43 126 451 28 94 61 34 301 104 309 127 116 44 82 21 312 222 294 186 112 210 161 261 131 484 219 430 271 310 184 67 149 119 291 125 267 449 ...
output:
11 24 21 28 23 15 49 44 74 63 67 81 34 43 61 82 84 104 116 119 125 91 94 112 132 126 131 143 149 170 161 127 156 148 184 186 188 191 195 196 222 210 217 219 244 252 236 264 249 256 267 272 281 261 287 294 280 271 309 301 310 312 323 291 335 331 334 337 339 355 366 382 329 354 365 377 372 397 368 383...
input:
recover 1 99 11 24 21 28 23 15 49 44 74 63 67 81 34 43 61 82 84 104 116 119 125 91 94 112 132 126 131 143 149 170 161 127 156 148 184 186 188 191 195 196 222 210 217 219 244 252 236 264 249 256 267 272 281 261 287 294 280 271 309 301 310 312 323 291 335 331 334 337 339 355 366 382 329 354 365 377 37...
output:
11 24 21 28 23 15 49 44 74 63 67 81 34 43 61 82 84 104 116 119 125 91 94 112 132 126 131 143 149 170 161 127 156 148 184 186 188 191 195 196 222 210 217 219 244 252 236 264 249 256 267 272 281 261 287 294 280 271 309 301 310 312 323 291 335 331 334 337 339 355 366 382 329 354 365 377 372 397 368 383...
result:
ok all correct (1 test case)
Test #4:
score: 100
Accepted
time: 2ms
memory: 5492kb
input:
transmit 9 20 130 404 101 44 439 315 251 150 63 463 202 322 48 139 15 276 212 332 238 46 30 470 31 62 452 226 135 150 419 30 380 494 32 386 179 253 451 106 384 116 197 80 133 474 151 293 104 54 350 334 433 40 197 419 332 235 451 154 411 319 78 10 474 125 377 93 336 385 256 188 395 66 449 363 94 223 ...
output:
101 44 15 63 48 202 139 130 46 276 251 212 463 238 150 315 322 332 404 439 32 54 104 135 31 226 253 334 433 451 30 116 106 133 151 80 62 150 350 293 197 179 384 419 380 386 474 470 452 494 105 78 38 10 94 214 223 171 93 66 57 245 197 188 154 235 256 259 125 312 332 363 336 395 377 444 479 313 337 ...
input:
recover 9 19 101 44 15 63 48 202 139 130 46 276 251 212 463 238 150 315 322 332 404 29 32 54 104 135 31 226 253 334 433 451 30 116 106 133 80 62 150 350 293 197 179 384 419 380 386 474 470 452 494 39 105 78 38 10 94 214 223 171 93 66 57 245 197 188 154 235 256 259 125 312 332 363 336 377 444 479 3...
output:
101 44 15 63 48 202 139 130 46 276 251 212 463 238 150 315 322 332 404 439 32 54 104 135 31 226 253 334 433 451 30 116 106 133 80 62 150 350 293 197 179 384 419 380 386 474 470 452 494 151 105 78 38 10 94 214 223 171 93 66 57 245 197 188 154 235 256 259 125 312 332 363 336 377 444 479 313 337 319 ...
result:
ok all correct (9 test cases)
Test #5:
score: 0
Wrong Answer
time: 4ms
memory: 5524kb
input:
transmit 81 100 345 473 156 472 449 361 478 451 332 324 120 264 105 37 287 102 369 417 331 458 284 55 25 115 279 489 257 468 463 200 174 431 408 492 411 227 140 303 89 35 12 371 169 139 485 480 20 373 220 211 330 138 228 466 432 44 166 80 443 24 92 21 160 376 351 190 214 173 132 322 163 340 7 282 40...
output:
1 7 12 20 21 25 24 35 38 37 44 53 55 77 71 80 89 92 102 115 114 105 120 132 138 151 139 140 156 153 160 163 169 166 173 174 186 190 193 200 203 211 220 207 214 227 233 269 228 257 264 275 282 279 287 304 322 303 284 324 331 330 332 340 345 347 351 358 371 361 373 369 376 408 409 411 417 425 414 431 ...
input:
recover 81 99 1 7 12 20 21 25 24 35 38 37 44 53 55 77 71 80 89 92 102 115 114 105 120 132 138 151 139 140 156 153 160 163 169 166 173 174 186 190 193 200 203 211 220 207 214 227 233 269 228 257 264 275 282 279 287 304 322 303 284 324 331 330 332 340 345 347 351 358 371 361 373 369 376 408 409 411 41...
output:
1 7 12 20 21 25 24 35 38 37 44 53 55 77 71 80 89 92 102 115 114 105 120 132 138 151 139 140 156 153 160 163 169 166 173 174 186 190 193 200 203 211 220 207 214 227 233 269 228 257 264 275 282 279 287 304 322 303 284 324 331 330 332 340 345 347 351 358 371 361 373 369 376 408 409 411 417 425 414 431 ...
result:
wrong answer incorrect answer. (test case 75)