Submission #697949

#TimeUsernameProblemLanguageResultExecution timeMemory
697949rukashiiBoat (APIO16_boat)C++17
9 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int maxn = 502, M_sub2 = 1e6 + 2, MOD = 1e9 + 7; int n; pair <int, int> a[maxn]; bool c1, c2, c3; long long dp[maxn]; long long power(long long a, long long b) { long long res = 1; while (b > 0) { if (b & 1) res = res * a % MOD; a = a * a % MOD; b >>= 1; } return res; } int mul(int a, int b) { return (a * b) % MOD; } void sub1() { long long ans = 1; dp[1] = 1; for (int i = 2; i <= n; i++) { dp[i] = 1; for (int j = 1; j < i; j++) { if (a[i].first > a[j].first) { // if (i == 2) // cout << j << ' ' << dp[j] << '\n'; dp[i] += dp[j]; dp[i] %= MOD; } } ans += dp[i]; ans %= MOD; } cout << ans; } signed main() { ios::sync_with_stdio(0); cin.tie(0); // freopen("input.txt", "r" , stdin); // freopen("output.txt", "w", stdout); int sum = 0, tmp = 1e9 + 7; cin >> n; for (int i = 1; i <= n; i++) { int x, y; cin >> x >> y; // if (x != y) // c1 = 1; a[i] = {x, y}; } // if (!c1) return sub1(), 0; }

Compilation message (stderr)

boat.cpp: In function 'int main()':
boat.cpp:60:9: warning: unused variable 'sum' [-Wunused-variable]
   60 |     int sum = 0, tmp = 1e9 + 7;
      |         ^~~
boat.cpp:60:18: warning: unused variable 'tmp' [-Wunused-variable]
   60 |     int sum = 0, tmp = 1e9 + 7;
      |                  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...