답안 #570221

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
570221 2022-05-28T21:06:43 Z Santos_Rivera Mountains (NOI20_mountains) C++14
64 / 100
2000 ms 4912 KB
#include<bits/stdc++.h>
using namespace std;
bool s(vector<long long> v, int n){
	int c=0;
	for(int i=0;i<n;i++){
		if(v[i]<=v[i+1]){
			c++;
		}
	}
	if(c==n){
		return true;
	}
	
	return false;
}
int main(){
	long long n,x,ci=0,cd=0,cont=0;
	cin>>n;
	vector<long long> v;
	v.reserve(n);
	for(int i=0;i<n;i++){
		cin>>x;
		v.push_back(x);
	}
	if(s(v,n)){
		cout<<"0 \n";
		return 0;
	}
	for(int i=1;i<n-1;i++){
		ci=0;cd=0;
		for(int j=0;j<i;j++){
			if(v[j]<v[i]){
				ci++;
			}
		}
		for(int k=i+1;k<n;k++){
			if(v[k]<v[i]){
				cd++;
			}
		}
		cont+=ci*cd;
	}
	cout<<cont<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Execution timed out 2080 ms 4860 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2066 ms 4912 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2066 ms 4912 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 284 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 284 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 84 ms 440 KB Output is correct
12 Correct 76 ms 428 KB Output is correct
13 Correct 79 ms 436 KB Output is correct
14 Correct 77 ms 432 KB Output is correct
15 Correct 74 ms 340 KB Output is correct
16 Correct 75 ms 428 KB Output is correct
17 Correct 80 ms 432 KB Output is correct
18 Correct 91 ms 340 KB Output is correct
19 Correct 74 ms 340 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2066 ms 4912 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Execution timed out 2080 ms 4860 KB Time limit exceeded
3 Halted 0 ms 0 KB -