Submission #421392

# Submission time Handle Problem Language Result Execution time Memory
421392 2021-06-09T06:34:41 Z Andyvanh1 Data Transfer (IOI19_transfer) C++14
40 / 100
79 ms 2528 KB
#include <bits/stdc++.h>
#include "transfer.h"
 
using namespace std;
 
#define vt vector
#define INF 0x3f3f3f3f
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,x) for(int (i) = 0;(i) < (x); (i)++)
#define MOD 1000000007
 
typedef vt<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
 
bool jump(int x){
    cout<<x<<endl;
    bool ans;
    cin>>ans;
    return ans;
}
 
vi get_attachment(vi source){
    vi ans(9);
    int x = 0;
    int ct = 0;
    for(int i = 1; i <= 255; i++){
        x^=i*(source[i-1]);
 
    }
    for(int i = 0; i < 8; i++){
        ans[i] = ((1<<i)&x ? 1 : 0);
        if(ans[i])ct++;
    }
    ans[8] = ct&1;
 
    return ans;
}
 
vi retrieve(vi data){
 
 
    vi ans1(255);
    vi ans2(8);
    int ans3;
    for(int i = 0; i < 255; i++){
        ans1[i] = data[i];
    }
    for(int i = 255; i < 263; i++){
        ans2[i-255] = data[i];
    }
    ans3 = data[263];
    int x = 0;
    int y = 0;
    int z = 0;
 
    for(int i = 1; i <= 255; i++){
        x^=i*(ans1[i-1]);
 
    }
    int ct = 0;
    for(int i = 0; i < 8; i++){
        y+=(1<<i)*ans2[i];
        if(ans2[i])ct++;
 
    }
    if(x==y)return ans1;
 
 
 
    if((ct&1)!=ans3){
        return ans1;
    }else{
 
        ans1[(x^y)-1]^=1;
        return ans1;
    }
 
}

Compilation message

transfer.cpp: In function 'vi retrieve(vi)':
transfer.cpp:57:9: warning: unused variable 'z' [-Wunused-variable]
   57 |     int z = 0;
      |         ^
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 624 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 63 ms 2472 KB Output is correct
2 Correct 61 ms 2464 KB Output is correct
3 Correct 66 ms 2476 KB Output is correct
4 Correct 60 ms 2468 KB Output is correct
5 Correct 79 ms 2464 KB Output is correct
6 Correct 61 ms 2468 KB Output is correct
7 Correct 60 ms 2480 KB Output is correct
8 Correct 66 ms 2464 KB Output is correct
9 Correct 62 ms 2464 KB Output is correct
10 Correct 62 ms 2464 KB Output is correct
11 Correct 62 ms 2364 KB Output is correct
12 Correct 62 ms 2424 KB Output is correct
13 Correct 78 ms 2480 KB Output is correct
14 Correct 61 ms 2464 KB Output is correct
15 Correct 62 ms 2436 KB Output is correct
16 Correct 61 ms 2468 KB Output is correct
17 Correct 63 ms 2464 KB Output is correct
18 Correct 62 ms 2528 KB Output is correct
19 Correct 66 ms 2520 KB Output is correct