답안 #675977

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
675977 2022-12-28T17:18:11 Z sudheerays123 Temperature (POI11_tem) C++17
0 / 100
228 ms 65536 KB
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll int
const ll N = 1e6+5 , K = 110 , INF = 1e9 , MOD = 1e9+7 ;

ll dp[N][K];
vector<pair<ll,ll>> a(N);
ll n;

ll go(ll i , ll preval){

	if(i == n+1) return 0;
	if(dp[i][preval] != -1) return dp[i][preval];
	
	ll ans = 0;
	for(ll val = a[i].first; val <= a[i].second; val++) if(preval == K || val >= preval) ans = max(ans,1+go(i+1,val));

	return dp[i][preval] = ans;
}

void solve(){

	cin >> n;
	for(ll i = 1; i <= n; i++){
		cin >> a[i].first >> a[i].second;
		a[i].first += 55;
		a[i].second += 55;
	}

	memset(dp,-1,sizeof dp);

	ll ans = 1;
	for(ll i = 1; i <= n; i++) ans = max(ans,go(i,K));

	cout << ans;
}

int main(){

	fast;

	ll tc = 1;
	// cin >> tc;
	while(tc--) solve();

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 27 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 28 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 31 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 86 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 142 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 189 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 228 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 195 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 122 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 116 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 177 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 165 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -