Submission #967900

# Submission time Handle Problem Language Result Execution time Memory
967900 2024-04-23T04:54:03 Z duckindog Boat (APIO16_boat) C++17
0 / 100
298 ms 440 KB
#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

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 time Memory Grader output
1 Incorrect 298 ms 440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 298 ms 440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 298 ms 440 KB Output isn't correct
2 Halted 0 ms 0 KB -