Submission #389007

#TimeUsernameProblemLanguageResultExecution timeMemory
389007mosiashvililukaBoat (APIO16_boat)C++14
9 / 100
2 ms332 KiB
#include<bits/stdc++.h> using namespace std; int a,b,c,d,e,i,j,ii,jj,zx,xc,mod=1000000007,sub1,f[509],DPI[509],pas; pair <int, int> p[509]; map <int, int> m; map <int, int>::iterator it; int main(){ ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); cin>>a; for(i=1; i<=a; i++){ cin>>p[i].first>>p[i].second; if(p[i].first!=p[i].second){ sub1=1; } } if(sub1==0){ DPI[a]=1; for(i=a-1; i>=1; i--){ for(j=i+1; j<=a; j++){ if(p[j].first>p[i].first){ DPI[i]+=DPI[j]; if(DPI[i]>=mod) DPI[i]-=mod; } } DPI[i]++; if(DPI[i]>=mod) DPI[i]-=mod; } for(i=1; i<=a; i++){ pas+=DPI[i]; if(pas>=mod) pas-=mod; } cout<<pas; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...