Submission #358400

# Submission time Handle Problem Language Result Execution time Memory
358400 2021-01-25T12:24:25 Z Ahmad_Hasan Data Transfer (IOI19_transfer) C++17
5 / 100
358 ms 5088 KB
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;


vector<int> get_attachment(vector<int>src){
    if(1){
        int n=src.size();
        for(int i=0;i<n;i++)src.push_back(src[i]);
        return src;
    }
    long long p=31;
    long long mod=1e9+7;
    long long ppow=1ll;
    long long hsh=0ll;
    int n=src.size();
    for(int i=0;i<n;i++){
        hsh+=src[i]*ppow;
        hsh%=mod;
        ppow*=p;
        ppow%=mod;
    }
    vector<int>ret(30);
    for(int i=0;i<30;i++)ret[i]=!!(hsh&(1<<i));

    return ret;
}

vector<int> retrieve(vector<int>data){
    vector<int>ret;
    if(1){
        int n=data.size();
        for(int i=0;i<n/3;i++){
            ret.push_back(((data[i]+data[n/3+i]+data[2*n/3+i])>=2)?1:0);
        }
    }else{

        long long p=31;
        long long mod=1e9+7;
        long long ppow=1ll;
        long long hsh=0ll;
        int n=data.size()-30;
        vector<int>ret;
        for(int i=0;i<n;i++){
            hsh+=data[i]*ppow;
            hsh%=mod;
            ppow*=p;
            ppow%=mod;
        }
        int f=0;
        for(int i=n;i<data.size();i++){
            if(data[i]!=!!(hsh&(1<<(i-n))))
                f=1;
        }
        if(!f){
            for(int i=0;i<n;i++){
                ret.push_back(data[i]);
            }
            return ret;
        }
        for(int i=0;i<n;i++){
            data[i]=!data[i];

            p=31;
            mod=1e9+7;
            ppow=1ll;
            hsh=0ll;
            for(int i=0;i<n;i++){
                hsh+=data[i]*ppow;
                hsh%=mod;
                ppow*=p;
                ppow%=mod;
            }
            int f=0;
            for(int i=n;i<data.size();i++){
                if(data[i]!=!!(hsh&(1<<(i-n))))
                    f=1;
            }
            if(!f){
                for(int i=0;i<n;i++){
                    ret.push_back(data[i]);
                }
                return ret;
            }

            data[i]=!data[i];
        }
        for(int i=0;i<n;i++){
            ret.push_back(data[i]);
        }
        return ret;

    }
    return ret;
}

Compilation message

transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:51:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |         for(int i=n;i<data.size();i++){
      |                     ~^~~~~~~~~~~~
transfer.cpp:75:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   75 |             for(int i=n;i<data.size();i++){
      |                         ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 8 ms 1196 KB Partially correct
2 Partially correct 11 ms 1144 KB Partially correct
3 Partially correct 9 ms 1444 KB Partially correct
4 Partially correct 8 ms 1144 KB Partially correct
5 Partially correct 8 ms 1444 KB Partially correct
6 Partially correct 8 ms 1016 KB Partially correct
7 Partially correct 8 ms 1144 KB Partially correct
8 Partially correct 8 ms 1016 KB Partially correct
9 Partially correct 8 ms 1144 KB Partially correct
10 Partially correct 8 ms 1016 KB Partially correct
11 Partially correct 9 ms 1144 KB Partially correct
12 Partially correct 8 ms 1016 KB Partially correct
13 Partially correct 8 ms 1196 KB Partially correct
14 Partially correct 11 ms 1188 KB Partially correct
15 Partially correct 9 ms 1476 KB Partially correct
16 Partially correct 8 ms 1188 KB Partially correct
17 Partially correct 8 ms 1360 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 306 ms 4896 KB Partially correct
2 Partially correct 264 ms 5088 KB Partially correct
3 Partially correct 260 ms 4772 KB Partially correct
4 Partially correct 282 ms 4932 KB Partially correct
5 Partially correct 258 ms 4912 KB Partially correct
6 Partially correct 269 ms 4956 KB Partially correct
7 Partially correct 259 ms 4920 KB Partially correct
8 Partially correct 260 ms 4912 KB Partially correct
9 Partially correct 264 ms 4772 KB Partially correct
10 Partially correct 297 ms 4772 KB Partially correct
11 Partially correct 270 ms 4920 KB Partially correct
12 Partially correct 334 ms 4772 KB Partially correct
13 Partially correct 269 ms 4912 KB Partially correct
14 Partially correct 358 ms 4912 KB Partially correct
15 Partially correct 336 ms 4920 KB Partially correct
16 Partially correct 279 ms 4900 KB Partially correct
17 Partially correct 271 ms 4900 KB Partially correct
18 Partially correct 275 ms 4900 KB Partially correct
19 Partially correct 261 ms 4920 KB Partially correct