Submission #61174

# Submission time Handle Problem Language Result Execution time Memory
61174 2018-07-25T09:56:52 Z Flugan42 Boat (APIO16_boat) C++14
0 / 100
3 ms 488 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef long double lld;
#define rep(i,a,b) for(ll i = a; i < b; i++)
#define per(i,a,b) for(ll i = a; i >= b; i--)
#define inf 1000000000000000000
#define all(x) x.begin(),x.end()
#define sz(x) (ll)(x).size()
#define trav(a,x) for(auto a : x)

const ll mod = 1000000007;
ll n;
vi a,b,s;

int main(){
  cin >> n;
  a.assign(n,0); b.assign(n,0);
  rep(i,0,n) {
    cin >> a[i] >> b[i];
    assert(b[i]-a[i] < 1000010);
    per(j,b[i],a[i]) { s.push_back(j); }
  }

  vi dp; dp.assign(sz(s),0);
  rep(i,0,sz(s)){
    dp[i] = 1;
    rep(j,0,i) if (s[j] < s[i]) dp[i] = (dp[i]+dp[j])%mod;
  }

  ll res = 0;
  rep(i,0,sz(s)) res += dp[i];
  cout << res << endl;

}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 488 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -