답안 #879080

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
879080 2023-11-26T09:30:50 Z willychan Security Guard (JOI23_guard) C++17
12 / 100
39 ms 5564 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include<bits/extc++.h>
//__gnu_pbds




int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n,m,q;cin>>n>>m>>q;
	int ans = 0;
	int ans2=0;
	int arr[n];
	for(int i=0;i<n;i++) cin>>arr[i];
	for(int i=0;i<n-1;i++){
		ans2+=max(arr[i],arr[i+1]);
	}
	int k = unique(arr,arr+n)-arr;
	for(int i=0;i<k-2;i++)  if(arr[i]>arr[i+1] && arr[i+1]<arr[i+2]) ans2-=min(abs(arr[i]-arr[i+1]),abs(arr[i+1]-arr[i+2]));
	for(int i=0;i<m;i++){
	 int u,v;cin>>u>>v;
	}
	cout<<ans2<<"\n";	
	return 0;
}

Compilation message

guard.cpp: In function 'int main()':
guard.cpp:13:6: warning: unused variable 'ans' [-Wunused-variable]
   13 |  int ans = 0;
      |      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 31 ms 1240 KB Output is correct
3 Correct 30 ms 1116 KB Output is correct
4 Correct 31 ms 1116 KB Output is correct
5 Correct 31 ms 1116 KB Output is correct
6 Correct 31 ms 1112 KB Output is correct
7 Correct 31 ms 1116 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 31 ms 1240 KB Output is correct
3 Correct 30 ms 1116 KB Output is correct
4 Correct 31 ms 1116 KB Output is correct
5 Correct 31 ms 1116 KB Output is correct
6 Correct 31 ms 1112 KB Output is correct
7 Correct 31 ms 1116 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Incorrect 39 ms 5564 KB Output isn't correct
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 31 ms 1240 KB Output is correct
3 Correct 30 ms 1116 KB Output is correct
4 Correct 31 ms 1116 KB Output is correct
5 Correct 31 ms 1116 KB Output is correct
6 Correct 31 ms 1112 KB Output is correct
7 Correct 31 ms 1116 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Incorrect 39 ms 5564 KB Output isn't correct
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 31 ms 1240 KB Output is correct
3 Correct 30 ms 1116 KB Output is correct
4 Correct 31 ms 1116 KB Output is correct
5 Correct 31 ms 1116 KB Output is correct
6 Correct 31 ms 1112 KB Output is correct
7 Correct 31 ms 1116 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Incorrect 39 ms 5564 KB Output isn't correct
11 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 31 ms 1240 KB Output is correct
3 Correct 30 ms 1116 KB Output is correct
4 Correct 31 ms 1116 KB Output is correct
5 Correct 31 ms 1116 KB Output is correct
6 Correct 31 ms 1112 KB Output is correct
7 Correct 31 ms 1116 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Incorrect 39 ms 5564 KB Output isn't correct
11 Halted 0 ms 0 KB -