답안 #914194

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
914194 2024-01-21T10:42:29 Z Litusiano Airplane (NOI23_airplane) C++17
0 / 100
40 ms 7772 KB
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math,inline")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,lzcnt,mmx,abm,avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define int long long

int n,m;

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>m;
	vector<vector<int>> G;
	vector<int> v(n); for(int& i : v) cin>>i;
	int trash;
	while(m--) cin>>trash>>trash;
	vector<int> suf(n+1); suf[n] = 0;	
	for(int i = n-1; i>=0 ; i--) suf[i] = max(v[i], suf[i+1]);
	int h = 0;
	int ans = 0;
	for(int i = 0; i<n; i++){
		if(v[i] > h){
			ans += v[i]-h; h = v[i]; // just go up
		}
		else if(h < suf[i]) h++, ans++;
		else if(h > suf[i]) h--, ans++;
		else ans++;
	}
	// cout<<ans<<" ";
	cout<<ans + h<<endl;
}	
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 36 ms 5132 KB Output is correct
3 Correct 37 ms 5564 KB Output is correct
4 Correct 38 ms 7248 KB Output is correct
5 Correct 39 ms 7768 KB Output is correct
6 Correct 40 ms 7760 KB Output is correct
7 Correct 40 ms 7772 KB Output is correct
8 Incorrect 1 ms 348 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 36 ms 5132 KB Output is correct
3 Correct 37 ms 5564 KB Output is correct
4 Correct 38 ms 7248 KB Output is correct
5 Correct 39 ms 7768 KB Output is correct
6 Correct 40 ms 7760 KB Output is correct
7 Correct 40 ms 7772 KB Output is correct
8 Incorrect 1 ms 348 KB Output isn't correct
9 Halted 0 ms 0 KB -