답안 #487475

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
487475 2021-11-15T16:38:40 Z cfalas Boat (APIO16_boat) C++14
0 / 100
1 ms 204 KB
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define INF 10000000
#define MOD 1000000007
#define MID ((l+r)/2)
#define HASHMOD 2305843009213693951
#define ll long long
#define ull unsigned long long
#define F first
#define S second
typedef pair<ll, ll> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef map<int, int> mii;

#define EPS 1e-6
#define FOR(i,n) for(int i=0;i<((int)(n));i++)
#define FORi(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define FOA(v, a) for(auto v : a)

int t, n;
vi a, b;

ll mpow(ll a, ll b){
	if(b==0) return 1;
	if(b==1) return a;
	ll z = mpow(a, b/2);
	z*=z;
	z%=MOD;
	if(b%2) z*=a;
	return z%MOD;
}

int main(){
	cin>>n;
	int dp[n+1];
	a.resize(n);
	FOR(i,n){
		cin>>a[i]>>a[i];
		dp[i] = 0;
	}
	dp[0] = 1;
	ll ans=0;
	FORi(i,1,n){
		FOR(j,i) if(a[j]<a[i]) dp[i] = max(dp[i], dp[j]+1);
		ans += mpow(2, dp[i]) - 1;
		ans %= MOD;
	}
	cout<<ans<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -