Submission #967900

#TimeUsernameProblemLanguageResultExecution timeMemory
967900duckindogBoat (APIO16_boat)C++17
0 / 100
298 ms440 KiB
#include <bits/stdc++.h> using namespace std; const int N = 500 + 10; int n; int a[N], b[N]; int32_t main() { cin.tie(0)->sync_with_stdio(0); cin >> n; for (int i = 1; i <= n; ++i) cin >> a[i] >> b[i]; int answer = 0; for (int bit = 1; bit < (1 << n - 1); ++bit) { int ma = 0; bool pass = true; for (int i = 1; i <= n; ++i) { if (bit >> i - 1 & 1) { pass &= (a[i] > ma); ma = max(ma, a[i]); } } answer += pass; } cout << answer << "\n"; }

Compilation message (stderr)

boat.cpp: In function 'int32_t main()':
boat.cpp:16:35: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   16 |   for (int bit = 1; bit < (1 << n - 1); ++bit) {
      |                                 ~~^~~
boat.cpp:20:20: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
   20 |       if (bit >> i - 1 & 1) {
      |                  ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...