Submission #1113153

# Submission time Handle Problem Language Result Execution time Memory
1113153 2024-11-16T00:22:12 Z michified Magic Show (APIO24_show) C++17
Compilation error
0 ms 0 KB
#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 <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

Alice.cpp: In function 'std::vector<std::pair<int, int> > Alice()':
Alice.cpp:14:10: error: 'setN' was not declared in this scope
   14 |   ll x = setN(4996);
      |          ^~~~

Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:21: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]
   21 |   for (int i = 0; i < v.size(); i++) cor[v[i].second - 1] = v[i].first - 1;
      |                   ~~^~~~~~~~~~