답안 #1049250

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1049250 2024-08-08T15:27:46 Z mar Exam (eJOI20_exam) C++14
12 / 100
70 ms 3360 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 100008;
 
 
int main() {
    int n; cin>>n;
    int ans=0;
	vector<int> a, b;
	bool flag = true;
	int inp;
	for(int i=0;i<n;i++) {
		cin>>inp; 
		a.push_back(inp);
		if(i>0 && inp <= a[i-1]) flag=false;
	}
	
	for(int i=0;i<n;i++){
	    cin>>inp;
	    b.push_back(inp);
	} 
	
	for(int i=0; i<n; i++) {
		if(a[i] != inp)continue;
		int tmp = i-1;
		while(tmp >= 0 && a[tmp] <= inp) {
			ans++;
			tmp--;
		}
		while(i < n && a[i] <= inp) {
			ans++;
			i++;
		}
	}
	cout<<ans<<endl;
    return 0;
}

Compilation message

exam.cpp: In function 'int main()':
exam.cpp:11:7: warning: variable 'flag' set but not used [-Wunused-but-set-variable]
   11 |  bool flag = true;
      |       ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 9 ms 1008 KB Output is correct
3 Correct 27 ms 2508 KB Output is correct
4 Correct 15 ms 1844 KB Output is correct
5 Correct 47 ms 3276 KB Output is correct
6 Correct 14 ms 1908 KB Output is correct
7 Correct 18 ms 2004 KB Output is correct
8 Correct 70 ms 3360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -