답안 #329140

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
329140 2020-11-19T12:54:29 Z oak Mountains (NOI20_mountains) C++14
64 / 100
2000 ms 3244 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,j,i;
	scanf("%d",&n);
	long long arr[n],sum[n];
	multiset<long long> ms;
	for(i=0;i<n;i++){
		scanf("%lld",&arr[i]);
		ms.insert(arr[i]);
		sum[i] = distance(ms.begin(),ms.lower_bound(arr[i]));
		//printf("%d ",sum[i]);
	}
	//printf("\n");
	long long ans = 0;
	ms.clear();
	for(i=n-1;i>=0;i--){
		ms.insert(arr[i]);
		sum[i] *= distance(ms.begin(),ms.lower_bound(arr[i]));
		ans += sum[i]*1ll;
		//printf("%d ",sum[i]);
	}
	//printf("\n");
	printf("%lld",ans);
}

Compilation message

Mountains.cpp: In function 'int main()':
Mountains.cpp:4:8: warning: unused variable 'j' [-Wunused-variable]
    4 |  int n,j,i;
      |        ^
Mountains.cpp:5:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    5 |  scanf("%d",&n);
      |  ~~~~~^~~~~~~~~
Mountains.cpp:9:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 |   scanf("%lld",&arr[i]);
      |   ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Execution timed out 2084 ms 1900 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2079 ms 3244 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2079 ms 3244 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 2 ms 364 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
6 Correct 2 ms 380 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Correct 2 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 2 ms 364 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
6 Correct 2 ms 380 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Correct 2 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 696 ms 1132 KB Output is correct
12 Correct 678 ms 1260 KB Output is correct
13 Correct 678 ms 1260 KB Output is correct
14 Correct 670 ms 1324 KB Output is correct
15 Correct 676 ms 1132 KB Output is correct
16 Correct 680 ms 1132 KB Output is correct
17 Correct 677 ms 1260 KB Output is correct
18 Correct 685 ms 1260 KB Output is correct
19 Correct 604 ms 1132 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2079 ms 3244 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Execution timed out 2084 ms 1900 KB Time limit exceeded
3 Halted 0 ms 0 KB -