Submission #1018850

#TimeUsernameProblemLanguageResultExecution timeMemory
1018850Ausp3xUnscrambling a Messy Bug (IOI16_messy)C++17
38 / 100
1 ms604 KiB
// 人外有人,天外有天 // author: Ausp3x #pragma GCC optimize("O1, O2, O3, Ofast, unroll-loops") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include "messy.h" using namespace std; using namespace __gnu_pbds; #define fi first #define se second #define pb push_back // #define DEBUG typedef long long lng; int const INF32 = 0x3f3f3f3f; lng const INF64 = 0x3f3f3f3f3f3f3f3f; #ifdef DEBUG int n; vector<int> P; vector<string> DS; void add_element(string x) { DS.pb(x); return; } map<string, bool> chk; void compile_set() { for (auto &x : DS) { string nx(n, 'X'); for (int i = 0; i < n; i++) nx[i] = x[P[i]]; chk[nx] = true; x = nx; } return; } bool check_element(string x) { return chk[x]; } #endif vector<int> restore_permutation(int n, int w, int r) { string inp(n, '0'); for (int i = 0; i < n; i++) { inp[i] = '1'; add_element(inp); } // for (auto x : DS) // cout << x << ' '; // cout << endl; compile_set(); // for (auto x : DS) // cout << x << ' '; // cout << endl; string q(n, '0'); vector<int> res(n); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (q[j] == '1') continue; q[j] = '1'; if (check_element(q)) { res[j] = i; break; } else q[j] = '0'; } } // for (int x : res) // cout << x << ' '; // cout << endl; return res; } #ifdef DEBUG int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; cin >> t; while (t--) { int w, r; cin >> n >> w >> r; P.clear(); P.resize(n); for (int &p : P) cin >> p; restore_permutation(n, w, r); } return 0; } #endif

Compilation message (stderr)

messy.cpp:4:55: warning: bad option '-f O2' to pragma 'optimize' [-Wpragmas]
    4 | #pragma GCC optimize("O1, O2, O3, Ofast, unroll-loops")
      |                                                       ^
messy.cpp:4:55: warning: bad option '-f O3' to pragma 'optimize' [-Wpragmas]
messy.cpp:4:55: warning: bad option '-f Ofast' to pragma 'optimize' [-Wpragmas]
messy.cpp:4:55: warning: bad option '-f unroll-loops' to pragma 'optimize' [-Wpragmas]
In file included from messy.cpp:7:
messy.h:6:31: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
    6 | void add_element(std::string x);
      |                               ^
messy.h:6:31: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
messy.h:6:31: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
messy.h:6:31: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
messy.h:6:31: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
messy.h:6:31: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
messy.h:6:31: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
messy.h:6:31: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
messy.h:7:33: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
    7 | bool check_element(std::string x);
      |                                 ^
messy.h:7:33: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
messy.h:7:33: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
messy.h:7:33: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
messy.h:7:33: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
messy.h:7:33: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
messy.h:7:33: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
messy.h:7:33: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
messy.h:8:18: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
    8 | void compile_set();
      |                  ^
messy.h:8:18: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
messy.h:8:18: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
messy.h:8:18: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
messy.h:8:18: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
messy.h:8:18: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
messy.h:8:18: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
messy.h:8:18: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
messy.h:10:57: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
   10 | std::vector<int> restore_permutation(int n, int w, int r);
      |                                                         ^
messy.h:10:57: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
messy.h:10:57: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
messy.h:10:57: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
messy.h:10:57: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
messy.h:10:57: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
messy.h:10:57: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
messy.h:10:57: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
messy.cpp:50:52: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
   50 | vector<int> restore_permutation(int n, int w, int r) {
      |                                                    ^
messy.cpp:50:52: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
messy.cpp:50:52: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
messy.cpp:50:52: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
#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...