Submission #566195

#TimeUsernameProblemLanguageResultExecution timeMemory
566195drdilyor앵무새 (IOI11_parrots)C++17
98 / 100
11 ms1416 KiB
#include "encoder.h"
#include "encoderlib.h"
#ifndef TEMPLATE_H
#define TEMPLATE_H
#ifdef ONPC
    //#define _GLIBCXX_DEBUG
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
    #define debug(...) 42
#endif
#define allit(a) (a).begin(), (a).end()
#define memclr(a) memset(a, 0, sizeof(0))
#define sz(a) ((int) (a).size())

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
template<typename T>
using uset = unordered_set<T>;
template<typename K, typename V>
using umap = unordered_map<K, V>;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/detail/standard_policies.hpp>
//namespace pd = __gnu_pbds;
//template<typename K>
//using ordered_set = pd::tree<
//    K,
//    pd::null_type,
//    less<int>,
//    pd::rb_tree_tag,
//    pd::tree_order_statistics_node_update>;
//using pd::gp_hash_table;

static void debug_out() {
    cerr << endl;
}
template<typename... Tail>
static void debug_out(vector<int> h, Tail... t) {
    cerr << "[";
    for (int i = 0; i < sz(h); i++) {
        if (i != 0) cerr << ", ";
        cerr << h[i];
    }
    cerr << "]";
    debug_out(t...);
}
template<typename P1, typename P2, typename... Tail>
static void debug_out(pair<P1, P2> h, Tail... t) {
    cerr << "[" << h.first << ", " << h.second << "]";
    debug_out(t...);
}
template<typename Head, typename... Tail>
static void debug_out(Head h, Tail... t) {
    cerr << "[" << h << "]";
    debug_out(t...);
}

static const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
struct chash {
    int operator() (int x) const { return x ^ RANDOM; }
};
static const int INF = 1e9+1;
static const ll INFL = 1e18+1;
static const int N = 1e5;
#endif

typedef array<int, 7> parrot;
vector<parrot> f = {{0, 0, 0, 0, 0, 0, 0},
 {0, 0, 0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 {1, 0, 0, 0, 1, 1, 1},
 {1, 0, 0, 0, 1, 2, 0},
 {1, 0, 0, 0, 2, 0, 0},
 {1, 0, 0, 0, 2, 0, 1},
 {1, 0, 0, 0, 2, 1, 0},
 {1, 0, 0, 0, 3, 0, 0},
 {1, 0, 0, 1, 0, 0, 0},
 {1, 0, 0, 1, 0, 0, 1},
 {1, 0, 0, 1, 0, 0, 2},
 {1, 0, 0, 1, 0, 1, 0},
 {1, 0, 0, 1, 0, 1, 1},
 {1, 0, 0, 1, 0, 2, 0},
 {1, 0, 0, 1, 1, 0, 0},
 {1, 0, 0, 1, 1, 0, 1},
 {1, 0, 0, 1, 1, 1, 0},
 {1, 0, 0, 1, 2, 0, 0},
 {1, 0, 0, 2, 0, 0, 0},
 {1, 0, 0, 2, 0, 0, 1},
 {1, 0, 0, 2, 0, 1, 0},
 {1, 0, 0, 2, 1, 0, 0},
 {1, 0, 0, 3, 0, 0, 0},
 {1, 0, 1, 0, 0, 0, 0},
 {1, 0, 1, 0, 0, 0, 1},
 {1, 0, 1, 0, 0, 0, 2},
 {1, 0, 1, 0, 0, 1, 0},
 {1, 0, 1, 0, 0, 1, 1},
 {1, 0, 1, 0, 0, 2, 0},
 {1, 0, 1, 0, 1, 0, 0},
 {1, 0, 1, 0, 1, 0, 1},
 {1, 0, 1, 0, 1, 1, 0},
 {1, 0, 1, 0, 2, 0, 0},
 {1, 0, 1, 1, 0, 0, 0}};

void encode(int n, int m[]) {
    int sum = 0;
    for (int i = 0; i < n; i++) {
        for (int j : f[m[i] ^ i]) {
            sum += j;
            send(sum);
        }
    }
    assert(sum <= 255);
}
#include "decoder.h"
#include "decoderlib.h"
#ifndef TEMPLATE_H
#define TEMPLATE_H
#ifdef ONPC
    //#define _GLIBCXX_DEBUG
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
    #define debug(...) 42
#endif
#define allit(a) (a).begin(), (a).end()
#define memclr(a) memset(a, 0, sizeof(0))
#define sz(a) ((int) (a).size())

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
template<typename T>
using uset = unordered_set<T>;
template<typename K, typename V>
using umap = unordered_map<K, V>;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/detail/standard_policies.hpp>
//namespace pd = __gnu_pbds;
//template<typename K>
//using ordered_set = pd::tree<
//    K,
//    pd::null_type,
//    less<int>,
//    pd::rb_tree_tag,
//    pd::tree_order_statistics_node_update>;
//using pd::gp_hash_table;

static void debug_out() {
    cerr << endl;
}
template<typename... Tail>
static void debug_out(vector<int> h, Tail... t) {
    cerr << "[";
    for (int i = 0; i < sz(h); i++) {
        if (i != 0) cerr << ", ";
        cerr << h[i];
    }
    cerr << "]";
    debug_out(t...);
}
template<typename P1, typename P2, typename... Tail>
static void debug_out(pair<P1, P2> h, Tail... t) {
    cerr << "[" << h.first << ", " << h.second << "]";
    debug_out(t...);
}
template<typename Head, typename... Tail>
static void debug_out(Head h, Tail... t) {
    cerr << "[" << h << "]";
    debug_out(t...);
}

static const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
struct chash {
    int operator() (int x) const { return x ^ RANDOM; }
};
static const int INF = 1e9+1;
static const ll INFL = 1e18+1;
static const int N = 1e5;
#endif

typedef array<int, 7> parrot;
vector<parrot> fs = {{0, 0, 0, 0, 0, 0, 0},
 {0, 0, 0, 0, 0, 0, 1},
 {0, 0, 0, 0, 0, 0, 2},
 {0, 0, 0, 0, 0, 0, 3},
 {0, 0, 0, 0, 0, 0, 4},
 {0, 0, 0, 0, 0, 1, 0},
 {0, 0, 0, 0, 0, 1, 1},
 {0, 0, 0, 0, 0, 1, 2},
 {0, 0, 0, 0, 0, 1, 3},
 {0, 0, 0, 0, 0, 2, 0},
 {0, 0, 0, 0, 0, 2, 1},
 {0, 0, 0, 0, 0, 2, 2},
 {0, 0, 0, 0, 0, 3, 0},
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0, 2, 0},
 {1, 0, 0, 1, 1, 0, 0},
 {1, 0, 0, 1, 1, 0, 1},
 {1, 0, 0, 1, 1, 1, 0},
 {1, 0, 0, 1, 2, 0, 0},
 {1, 0, 0, 2, 0, 0, 0},
 {1, 0, 0, 2, 0, 0, 1},
 {1, 0, 0, 2, 0, 1, 0},
 {1, 0, 0, 2, 1, 0, 0},
 {1, 0, 0, 3, 0, 0, 0},
 {1, 0, 1, 0, 0, 0, 0},
 {1, 0, 1, 0, 0, 0, 1},
 {1, 0, 1, 0, 0, 0, 2},
 {1, 0, 1, 0, 0, 1, 0},
 {1, 0, 1, 0, 0, 1, 1},
 {1, 0, 1, 0, 0, 2, 0},
 {1, 0, 1, 0, 1, 0, 0},
 {1, 0, 1, 0, 1, 0, 1},
 {1, 0, 1, 0, 1, 1, 0},
 {1, 0, 1, 0, 2, 0, 0},
 {1, 0, 1, 1, 0, 0, 0}};

int F(parrot p) {
    for (int i = 0; i < fs.size(); i ++) {
        int bad = 0;
        for (int j = 0; j < p.size(); j++) {
            if (p[j] != fs[i][j]) {
                bad = 1;
                break;
            }
        }
        if (!bad) return i;
    }
    assert(false);
}

void decode(int n, int l, int x[]) {
    sort(x, x + l);
    int last = 0;
    for (int i = 0; i < l; i += 7) {
        parrot p;
        for (int j = 0; j < p.size(); j++) {
            int cur = x[i+j] - last;
            p[j] = cur;
            last = x[i+j];
        }
        output(F(p)^(i/7));
    }
}

Compilation message (stderr)

encoder.cpp:39:13: warning: 'void debug_out()' defined but not used [-Wunused-function]
   39 | static void debug_out() {
      |             ^~~~~~~~~

decoder.cpp: In function 'int F(parrot)':
decoder.cpp:331:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 7> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  331 |     for (int i = 0; i < fs.size(); i ++) {
      |                     ~~^~~~~~~~~~~
decoder.cpp:333:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::array<int, 7>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  333 |         for (int j = 0; j < p.size(); j++) {
      |                         ~~^~~~~~~~~~
decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:349:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::array<int, 7>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  349 |         for (int j = 0; j < p.size(); j++) {
      |                         ~~^~~~~~~~~~
decoder.cpp: At global scope:
decoder.cpp:39:13: warning: 'void debug_out()' defined but not used [-Wunused-function]
   39 | static void debug_out() {
      |             ^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...