제출 #799021

#제출 시각아이디문제언어결과실행 시간메모리
799021vjudge1Port Facility (JOI17_port_facility)C++17
10 / 100
172 ms332 KiB
#ifdef Home #define _GLIBCXX_DEBUG #endif // Home #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; main() { #ifdef Home freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif // Home ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int tm[2 * n]; for(int i = 1, a, b; i <= n; ++ i) { cin >> a >> b; -- a; -- b; tm[a] = i + 1; tm[b] = - (i + 1); } if(n < 21) { ll ans = 0; for(int msk = (1<<n); msk --> 0;) { stack < int > A, B; for(int i = 0; i < 2 * n; ++ i) { if(tm[i] > 0) { if((1<<(tm[i] - 1))&msk) { B.push(tm[i]); } else { A.push(tm[i]); } } else { if((1<<(-tm[i] - 1))&msk) { if(B.empty() || B.top() != -tm[i]) { goto BREAK; } B.pop(); } else { if(A.empty() || A.top() != -tm[i]) { goto BREAK; } A.pop(); } } } ++ ans; BREAK: { }; } cout << ans; } }

컴파일 시 표준 에러 (stderr) 메시지

port_facility.cpp:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   12 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...