답안 #1113154

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1113154 2024-11-16T00:24:35 Z michified 마술쇼 (APIO24_show) C++17
0 / 100
2 ms 1300 KB
#include "Alice.h"
#include <bits/stdc++.h>
#define ll long long
#define db double
#define imx INT_MAX
#define imn INT_MIN
#define lmx LLONG_MAX
#define lmn LLONG_MIN
#define ld long double
#define lid id * 2 + 1
#define rid id * 2 + 2
using namespace std;

vector<pair<int, int>> Alice(){
  ll x = setN(4996);
  srand(0);
  vector<pair<int, int>> v;
  auto rng = default_random_engine {};
  vector<int> perm;
  for (int i = 10; i < 4996; i++) perm.push_back(i + 1);
  for (int i = 0; i < 9; i++) v.push_back(make_pair(i + 1, i + 2));
  shuffle(begin(perm), end(perm), rng);
  for (int i = 0; i < 18; i++) {
    for (int j = 0; j < 277; j++) {
      v.push_back(make_pair(x % 10 + 1, perm.back()));
      perm.pop_back();
    }
    x /= 10;
  }
  return v;
}
#include "Bob.h"
#include <bits/stdc++.h>
#define ll long long
#define db double
#define imx INT_MAX
#define imn INT_MIN
#define lmx LLONG_MAX
#define lmn LLONG_MIN
#define ld long double
#define lid id * 2 + 1
#define rid id * 2 + 2
using namespace std;

ll Bob(vector<pair<int, int>> v){
  srand(0);
  ll ans = 0, mult = 1;
  unordered_map<int, int> cor;
  auto rng = default_random_engine {};
  vector<int> perm;
  for (int i = 10; i < 4996; i++) perm.push_back(i);
  shuffle(begin(perm), end(perm), rng);
  for (int i = 0; i < v.size(); i++) cor[v[i].second - 1] = v[i].first - 1;
  for (int i = 0; i < 18; i++) {
    bool added = false;
    for (int j = 0; j < 277; j++) {
      if (added) continue;
      if (cor.find(perm.back() - 1) == cor.end()) {
        perm.pop_back();
        continue;
      }
      ans += mult * cor[perm.back() - 1];
      added = true;
      perm.pop_back();
    }
    if (not added) return -1;
    mult *= 10;
  }
  return ans;
}

Compilation message

Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:22:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |   for (int i = 0; i < v.size(); i++) cor[v[i].second - 1] = v[i].first - 1;
      |                   ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1300 KB Incorrect answer.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1300 KB Incorrect answer.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1300 KB Incorrect answer.
2 Halted 0 ms 0 KB -