(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #1122916

#TimeUsernameProblemLanguageResultExecution timeMemory
1122916vjudge1Unscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
2 ms584 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; void insert_all(int n, int j, string mask) { if (n == 1) return; string mask1(mask.begin(), mask.end()), mask2(mask.begin(), mask.end()); for (int i = j; i < j + n / 2; i++) { string s(mask.begin(), mask.end()); s[i] = '1'; add_element(s); mask2[i] = '1'; } for (int i = j + n / 2; i < j + n; i++) mask1[i] = '1'; insert_all(n / 2, j, mask1); insert_all(n / 2, j + n / 2, mask2); } void retrieve_permutation(int n, int j, string mask, vector<int> &p) { if (n == 1) { for (int i = 0; i < mask.size(); i++) if (mask[i] == '0') { p[i] = j; return; } } string mask1(mask.begin(), mask.end()), mask2(mask.begin(), mask.end()); for (int i = 0; i < mask.size(); i++) { if (mask[i] == '0') { string s(mask.begin(), mask.end()); s[i] = '1'; if (check_element(s)) mask2[i] = '1'; else mask1[i] = '1'; } } retrieve_permutation(n / 2, j, mask1, p); retrieve_permutation(n / 2, j + n / 2, mask2, p); } std::vector<int> restore_permutation(int n, int w, int r) { string mask; for (int i = 0; i < n; i++) mask.push_back('0'); insert_all(n, 0, mask); compile_set(); vector<int> p(n); retrieve_permutation(n, 0, mask, p); return p; // }

Compilation message (stderr)

messy.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
messy_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...