QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#322948#2351. Lost in Transfertuanlinh1230 4ms5840kbC++201.3kb2024-02-08 01:17:352024-02-08 01:17:35

Judging History

你现在查看的是最新测评结果

  • [2024-02-08 01:17:35]
  • 评测
  • 测评结果:0
  • 用时:4ms
  • 内存:5840kb
  • [2024-02-08 01:17:35]
  • 提交

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*2)%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();
    }
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 5536kb

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:

58 98 271 99 296 459 405 388 378 333 467 325 32 330 267 97 87 374 403 426 
32 61 68 86 26 120 118 100 125 136 150 192 281 339 444 451 481 292 494 495 

input:

recover
2
19 58 98 271 99 296 459 405 388 378 333 467 325 32 330 267 97 87 374 403 
19 32 61 68 86 120 118 100 125 136 150 192 281 339 444 451 481 292 494 495 

output:

58 98 271 99 296 459 405 388 378 333 467 325 32 330 267 97 87 374 403 426 
32 61 68 86 120 118 100 125 136 150 192 281 339 444 451 481 292 494 495 26 

result:

ok all correct (2 test cases)

Test #2:

score: 100
Accepted
time: 2ms
memory: 5540kb

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: 5576kb

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:

21 11 24 15 28 23 49 43 34 44 61 63 67 74 81 91 82 84 125 116 94 104 112 119 126 131 148 127 143 132 149 156 188 184 170 161 186 191 195 217 222 196 219 210 236 252 256 261 244 267 264 249 271 272 280 287 309 291 323 281 310 301 312 294 334 335 329 337 339 331 354 368 355 366 365 372 395 386 382 389...

input:

recover
1
99 21 11 24 15 28 23 49 43 34 44 61 63 67 74 81 91 82 84 125 116 94 104 112 119 126 131 148 127 143 132 149 156 188 184 170 161 186 191 195 217 222 196 219 210 236 252 256 261 244 267 264 249 271 272 280 287 309 291 323 281 310 301 312 294 334 335 329 337 339 331 354 368 355 366 365 372 39...

output:

21 11 24 15 28 23 49 43 34 44 61 63 67 74 81 91 82 84 125 116 94 104 112 119 126 131 148 127 143 132 149 156 188 184 170 161 186 191 195 217 222 196 219 210 236 252 256 261 244 267 264 249 271 272 280 287 309 291 323 281 310 301 312 294 334 335 329 337 339 331 354 368 355 366 365 372 395 386 382 389...

result:

ok all correct (1 test case)

Test #4:

score: 100
Accepted
time: 2ms
memory: 5600kb

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:

46 44 101 212 15 139 130 48 63 150 276 238 202 251 332 404 315 439 322 463 
30 116 80 62 133 106 32 54 104 135 253 226 31 150 380 197 179 151 419 384 470 452 474 293 451 433 334 494 386 350 
94 105 78 10 93 66 57 197 188 125 38 235 223 214 154 171 319 256 336 245 313 259 312 332 337 363 377 385 395 ...

input:

recover
9
19 46 44 101 212 15 139 130 48 63 150 276 238 202 251 332 404 315 439 322 
29 30 116 80 62 133 106 32 54 104 135 253 226 31 150 197 179 151 419 384 470 452 474 293 451 433 334 494 386 350 
39 94 105 78 10 93 66 57 197 188 125 38 235 223 214 154 171 319 256 336 245 313 259 312 337 363 377 3...

output:

46 44 101 212 15 139 130 48 63 150 276 238 202 251 332 404 315 439 322 463 
30 116 80 62 133 106 32 54 104 135 253 226 31 150 197 179 151 419 384 470 452 474 293 451 433 334 494 386 350 380 
94 105 78 10 93 66 57 197 188 125 38 235 223 214 154 171 319 256 336 245 313 259 312 337 363 377 385 395 430 ...

result:

ok all correct (9 test cases)

Test #5:

score: 0
Wrong Answer
time: 4ms
memory: 5840kb

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 24 25 21 35 38 37 44 53 55 77 71 80 89 92 105 114 132 115 140 102 120 138 139 151 156 153 160 163 166 169 173 186 174 190 193 200 203 211 207 214 220 227 257 275 228 233 264 269 282 279 284 303 287 322 304 324 332 330 340 331 347 345 351 358 371 369 361 373 376 408 409 414 411 417 431 432 ...

input:

recover
81
99 1 7 12 20 24 25 21 35 38 37 44 53 55 77 71 80 89 92 105 114 132 115 140 102 120 138 139 151 156 153 160 163 166 169 173 186 174 190 193 200 203 211 207 214 220 227 257 275 228 233 264 269 282 279 284 303 287 322 304 324 332 330 340 331 347 345 351 358 371 369 361 373 376 408 409 414 41...

output:

1 7 12 20 24 25 21 35 38 37 44 53 55 77 71 80 89 92 105 114 132 115 140 102 120 138 139 151 156 153 160 163 166 169 173 186 174 190 193 200 203 211 207 214 220 227 257 275 228 233 264 269 282 279 284 303 287 322 304 324 332 330 340 331 347 345 351 358 371 369 361 373 376 408 409 414 411 417 431 432 ...

result:

wrong answer incorrect answer. (test case 71)