Submission #1061076

# Submission time Handle Problem Language Result Execution time Memory
1061076 2024-08-16T06:13:01 Z vjudge1 Data Transfer (IOI19_transfer) C++17
100 / 100
52 ms 2520 KB
#include "transfer.h"
using namespace std;
vector<int> get_attachment(vector<int> source) {
    vector<int>stuf;
    int n=source.size(),xorr=0,K=0;
    for(int i=0;i<n;i++)
        xorr^=source[i]*(i+1),K+=source[i];
    vector<int>res;
    res.push_back(K&1);
    if(n<64)for(int i=6;i--;)
        res.push_back(xorr>>i&1);
    else for(int i=8;i--;)
        res.push_back(xorr>>i&1);
    return res;
}

std::vector<int> retrieve(std::vector<int> data) {
    int n=data.size()-7;
    if(data.size()>70)n-=2;
    vector<int>firstcup;
    int xorr=0,K=0;
    for(int i=0;i<n;i++)
        xorr^=data[i]*(i+1),K+=data[i],
        firstcup.push_back(data[i]);
    K&=1;
    int failodd=data[n]!=K;
    int xorgiv=0;
    for(int i=n+1;i<data.size();i++)
        xorgiv=xorgiv<<1|data[i];
    if(failodd&&xorgiv^xorr)
        firstcup[(xorgiv^xorr)-1]^=1;
    return firstcup;
}

Compilation message

transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:28:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int i=n+1;i<data.size();i++)
      |                   ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 784 KB Output is correct
2 Correct 2 ms 836 KB Output is correct
3 Correct 1 ms 792 KB Output is correct
4 Correct 2 ms 800 KB Output is correct
5 Correct 3 ms 800 KB Output is correct
6 Correct 2 ms 792 KB Output is correct
7 Correct 2 ms 1040 KB Output is correct
8 Correct 2 ms 800 KB Output is correct
9 Correct 2 ms 796 KB Output is correct
10 Correct 2 ms 800 KB Output is correct
11 Correct 1 ms 796 KB Output is correct
12 Correct 1 ms 800 KB Output is correct
13 Correct 3 ms 788 KB Output is correct
14 Correct 1 ms 896 KB Output is correct
15 Correct 2 ms 792 KB Output is correct
16 Correct 2 ms 800 KB Output is correct
17 Correct 2 ms 792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 2504 KB Output is correct
2 Correct 43 ms 2516 KB Output is correct
3 Correct 52 ms 2516 KB Output is correct
4 Correct 41 ms 2512 KB Output is correct
5 Correct 41 ms 2512 KB Output is correct
6 Correct 41 ms 2516 KB Output is correct
7 Correct 41 ms 2520 KB Output is correct
8 Correct 41 ms 2520 KB Output is correct
9 Correct 45 ms 2500 KB Output is correct
10 Correct 41 ms 2516 KB Output is correct
11 Correct 47 ms 2516 KB Output is correct
12 Correct 41 ms 2508 KB Output is correct
13 Correct 51 ms 2516 KB Output is correct
14 Correct 42 ms 2516 KB Output is correct
15 Correct 42 ms 2516 KB Output is correct
16 Correct 41 ms 2508 KB Output is correct
17 Correct 42 ms 2508 KB Output is correct
18 Correct 41 ms 2516 KB Output is correct
19 Correct 41 ms 2520 KB Output is correct