Submission #967904

# Submission time Handle Problem Language Result Execution time Memory
967904 2024-04-23T04:57:02 Z duckindog Boat (APIO16_boat) C++17
0 / 100
683 ms 448 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); ++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:20:20: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
   20 |       if (bit >> i - 1 & 1) {
      |                  ~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 683 ms 448 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 683 ms 448 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 683 ms 448 KB Output isn't correct
2 Halted 0 ms 0 KB -