제출 #1330570

#제출 시각아이디문제언어결과실행 시간메모리
1330570nicolo_010Treasure (IOI24_treasure)C++20
21 / 100
73 ms2944 KiB
#include "treasure.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int f(int x, int y) {
    return y+10000*x;
}

std::vector<int> encode(std::vector<std::pair<int, int>> P) {
    int n = P.size();
    vector<int> a(n);
    for (int i=0; i<n; i++) {
        a[i] = f(P[i].first, P[i].second);
    }
    return a;
}

std::vector<std::pair<int, int>> decode(std::vector<int> S) {
    vector<pii> a;
    for (auto s : S) {
        int y=0;
        int pw=1;
        for (int i=0; i<4; i++) {
            y += (s%10)*pw;
            pw *= 10;
            s /= 10;
        }
        int x=0;
        pw=1;
        for (int i=0; i<4; i++) {
            x += (s%10)*pw;
            pw *= 10;
            s /= 10;
        }
        a.push_back({x, y});
    }
    return a;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...