Submission #1029858

#TimeUsernameProblemLanguageResultExecution timeMemory
1029858KasymKBoat (APIO16_boat)C++17
9 / 100
1 ms448 KiB
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
const int MOD = 1e9+7;
const int N = 5e2+5;
ll dp[N], a[N], b[N];

void solve(){
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; ++i)
		scanf("%lld%lld", &a[i], &b[i]);
	ll ans = 0;
	for(int i = 0; i < n; ++i){
		dp[i] = 1;
		for(int j = 0; j < i; ++j)
			if(a[j] < a[i])
				dp[i] += dp[j];
		dp[i] %= MOD;
		(ans += dp[i]) %= MOD;
	}
	printf("%lld\n", ans);
}

int main(){
	int t = 1;
	// scanf("%d", &t);
	while(t--)
		solve();
	return 0;
}

Compilation message (stderr)

boat.cpp: In function 'void solve()':
boat.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
boat.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   scanf("%lld%lld", &a[i], &b[i]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...