Submission #69131

#TimeUsernameProblemLanguageResultExecution timeMemory
69131Just_Solve_The_ProblemPort Facility (JOI17_port_facility)C++11
10 / 100
940 ms748 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define eb emplace_back #define ll long long #define pii pair < int, int > #define fr first #define sc second #define mk make_pair #define sz(s) (int)s.size() #define all(s) s.begin(), s.end() #define OK puts("ok"); #define whatis(x) cerr << #x << " = " << x << endl; #define pause system("pause"); const int N = (int)1e6 + 7; const int inf = (int)1e9 + 7; pii ar[N]; int st[30]; int ans; main() { int n; scanf("%d", &n); assert(n <= 20); vector < int > v1(n + n + 1); for (int i = 0; i < n; i++) { scanf("%d %d", &ar[i].fr, &ar[i].sc); v1[ar[i].fr] = i; v1[ar[i].sc] = i + n; } for (int mask = 0; mask < (1 << n); mask++) { vector < int > stk[2]; bool ok = 1; for (int i = 1; i <= n + n; i++) { int bit = (mask >> (v1[i] % n)) & 1; if (v1[i] >= n) { if (stk[bit].back() == v1[i] - n) { stk[bit].pop_back(); } else { ok = 0; } } else { stk[bit].pb(v1[i]); } } ans += ok; } cout << ans; }

Compilation message (stderr)

port_facility.cpp:25:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
port_facility.cpp: In function 'int main()':
port_facility.cpp:27:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &n);
   ~~~~~^~~~~~~~~~
port_facility.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &ar[i].fr, &ar[i].sc);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...