답안 #320891

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
320891 2020-11-10T07:14:39 Z egas Pilot (NOI19_pilot) C++14
55 / 100
1000 ms 9728 KB
#include <bits/stdc++.h>

using namespace std;

int32_t main() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    long long n;

    cin >> n;

    long long m;

    cin >> m;

    vector<long long> a(n);

    for(long long i = 0 ; i < n ; i++) {

        cin >> a[i];

    }

    vector<long long> b(m);

    for(long long i = 0 ; i < m ; i++) {

        cin >> b[i];

    }

    vector<long long> diff(1000005,0);

    for(long long i=0; i<n; i++) {

        long long ryt=0;

        for(long long j=i+1; j<a.size(); j++) {

            if(a[j]>a[i])break;

            ryt++;

        }

        long long left=0;

        for(long long j=i-1; j>=0; j--) {

            if(a[j]>=a[i])break;

            left++;

        }

        diff[a[i]]+=((left+1)*(ryt+1));

    }

    for(long long i=1; i<diff.size(); i++) {

        diff[i]+=diff[i-1];

    }

    for(long long i = 0 ; i < b.size() ; i++) {

        cout << diff[b[i]] << '\n';

    }

    return 0;

}

Compilation message

pilot.cpp: In function 'int32_t main()':
pilot.cpp:41:31: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         for(long long j=i+1; j<a.size(); j++) {
      |                              ~^~~~~~~~~
pilot.cpp:63:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |     for(long long i=1; i<diff.size(); i++) {
      |                        ~^~~~~~~~~~~~
pilot.cpp:69:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 |     for(long long i = 0 ; i < b.size() ; i++) {
      |                           ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 8172 KB Output is correct
2 Correct 8 ms 8172 KB Output is correct
3 Correct 8 ms 8172 KB Output is correct
4 Correct 8 ms 8172 KB Output is correct
5 Correct 8 ms 8172 KB Output is correct
6 Correct 9 ms 8172 KB Output is correct
7 Correct 8 ms 8112 KB Output is correct
8 Correct 8 ms 8172 KB Output is correct
9 Correct 8 ms 8172 KB Output is correct
10 Correct 8 ms 8172 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 8172 KB Output is correct
2 Correct 8 ms 8172 KB Output is correct
3 Correct 8 ms 8172 KB Output is correct
4 Correct 8 ms 8172 KB Output is correct
5 Correct 8 ms 8172 KB Output is correct
6 Correct 9 ms 8172 KB Output is correct
7 Correct 8 ms 8112 KB Output is correct
8 Correct 8 ms 8172 KB Output is correct
9 Correct 8 ms 8172 KB Output is correct
10 Correct 8 ms 8172 KB Output is correct
11 Correct 9 ms 8172 KB Output is correct
12 Correct 8 ms 8172 KB Output is correct
13 Correct 8 ms 8172 KB Output is correct
14 Correct 8 ms 8172 KB Output is correct
15 Correct 9 ms 8300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 8172 KB Output is correct
2 Correct 8 ms 8172 KB Output is correct
3 Correct 8 ms 8172 KB Output is correct
4 Correct 8 ms 8172 KB Output is correct
5 Correct 8 ms 8172 KB Output is correct
6 Correct 9 ms 8172 KB Output is correct
7 Correct 8 ms 8112 KB Output is correct
8 Correct 8 ms 8172 KB Output is correct
9 Correct 8 ms 8172 KB Output is correct
10 Correct 8 ms 8172 KB Output is correct
11 Correct 9 ms 8172 KB Output is correct
12 Correct 8 ms 8172 KB Output is correct
13 Correct 8 ms 8172 KB Output is correct
14 Correct 8 ms 8172 KB Output is correct
15 Correct 9 ms 8300 KB Output is correct
16 Correct 9 ms 8172 KB Output is correct
17 Correct 8 ms 8172 KB Output is correct
18 Correct 8 ms 8172 KB Output is correct
19 Correct 8 ms 8124 KB Output is correct
20 Correct 8 ms 8172 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 8172 KB Output is correct
2 Correct 8 ms 8172 KB Output is correct
3 Correct 8 ms 8172 KB Output is correct
4 Correct 8 ms 8172 KB Output is correct
5 Correct 8 ms 8172 KB Output is correct
6 Correct 9 ms 8172 KB Output is correct
7 Correct 8 ms 8112 KB Output is correct
8 Correct 8 ms 8172 KB Output is correct
9 Correct 8 ms 8172 KB Output is correct
10 Correct 8 ms 8172 KB Output is correct
11 Correct 9 ms 8172 KB Output is correct
12 Correct 8 ms 8172 KB Output is correct
13 Correct 8 ms 8172 KB Output is correct
14 Correct 8 ms 8172 KB Output is correct
15 Correct 9 ms 8300 KB Output is correct
16 Correct 9 ms 8172 KB Output is correct
17 Correct 8 ms 8172 KB Output is correct
18 Correct 8 ms 8172 KB Output is correct
19 Correct 8 ms 8124 KB Output is correct
20 Correct 8 ms 8172 KB Output is correct
21 Correct 9 ms 8172 KB Output is correct
22 Correct 9 ms 8172 KB Output is correct
23 Correct 9 ms 8172 KB Output is correct
24 Correct 8 ms 8172 KB Output is correct
25 Correct 8 ms 8168 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 8940 KB Output is correct
2 Correct 23 ms 9572 KB Output is correct
3 Correct 21 ms 9452 KB Output is correct
4 Correct 22 ms 9452 KB Output is correct
5 Correct 20 ms 9452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1056 ms 9728 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1065 ms 9580 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 8172 KB Output is correct
2 Correct 8 ms 8172 KB Output is correct
3 Correct 8 ms 8172 KB Output is correct
4 Correct 8 ms 8172 KB Output is correct
5 Correct 8 ms 8172 KB Output is correct
6 Correct 9 ms 8172 KB Output is correct
7 Correct 8 ms 8112 KB Output is correct
8 Correct 8 ms 8172 KB Output is correct
9 Correct 8 ms 8172 KB Output is correct
10 Correct 8 ms 8172 KB Output is correct
11 Correct 21 ms 8940 KB Output is correct
12 Correct 23 ms 9572 KB Output is correct
13 Correct 21 ms 9452 KB Output is correct
14 Correct 22 ms 9452 KB Output is correct
15 Correct 20 ms 9452 KB Output is correct
16 Correct 20 ms 9452 KB Output is correct
17 Correct 29 ms 9580 KB Output is correct
18 Correct 24 ms 9580 KB Output is correct
19 Correct 20 ms 9452 KB Output is correct
20 Correct 28 ms 9580 KB Output is correct
21 Correct 24 ms 9452 KB Output is correct
22 Correct 24 ms 9580 KB Output is correct
23 Correct 20 ms 9708 KB Output is correct
24 Correct 22 ms 9452 KB Output is correct
25 Correct 20 ms 9452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 8172 KB Output is correct
2 Correct 8 ms 8172 KB Output is correct
3 Correct 8 ms 8172 KB Output is correct
4 Correct 8 ms 8172 KB Output is correct
5 Correct 8 ms 8172 KB Output is correct
6 Correct 9 ms 8172 KB Output is correct
7 Correct 8 ms 8112 KB Output is correct
8 Correct 8 ms 8172 KB Output is correct
9 Correct 8 ms 8172 KB Output is correct
10 Correct 8 ms 8172 KB Output is correct
11 Correct 9 ms 8172 KB Output is correct
12 Correct 8 ms 8172 KB Output is correct
13 Correct 8 ms 8172 KB Output is correct
14 Correct 8 ms 8172 KB Output is correct
15 Correct 9 ms 8300 KB Output is correct
16 Correct 9 ms 8172 KB Output is correct
17 Correct 8 ms 8172 KB Output is correct
18 Correct 8 ms 8172 KB Output is correct
19 Correct 8 ms 8124 KB Output is correct
20 Correct 8 ms 8172 KB Output is correct
21 Correct 9 ms 8172 KB Output is correct
22 Correct 9 ms 8172 KB Output is correct
23 Correct 9 ms 8172 KB Output is correct
24 Correct 8 ms 8172 KB Output is correct
25 Correct 8 ms 8168 KB Output is correct
26 Correct 21 ms 8940 KB Output is correct
27 Correct 23 ms 9572 KB Output is correct
28 Correct 21 ms 9452 KB Output is correct
29 Correct 22 ms 9452 KB Output is correct
30 Correct 20 ms 9452 KB Output is correct
31 Execution timed out 1056 ms 9728 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 8172 KB Output is correct
2 Correct 8 ms 8172 KB Output is correct
3 Correct 8 ms 8172 KB Output is correct
4 Correct 8 ms 8172 KB Output is correct
5 Correct 8 ms 8172 KB Output is correct
6 Correct 9 ms 8172 KB Output is correct
7 Correct 8 ms 8112 KB Output is correct
8 Correct 8 ms 8172 KB Output is correct
9 Correct 8 ms 8172 KB Output is correct
10 Correct 8 ms 8172 KB Output is correct
11 Correct 9 ms 8172 KB Output is correct
12 Correct 8 ms 8172 KB Output is correct
13 Correct 8 ms 8172 KB Output is correct
14 Correct 8 ms 8172 KB Output is correct
15 Correct 9 ms 8300 KB Output is correct
16 Correct 9 ms 8172 KB Output is correct
17 Correct 8 ms 8172 KB Output is correct
18 Correct 8 ms 8172 KB Output is correct
19 Correct 8 ms 8124 KB Output is correct
20 Correct 8 ms 8172 KB Output is correct
21 Correct 9 ms 8172 KB Output is correct
22 Correct 9 ms 8172 KB Output is correct
23 Correct 9 ms 8172 KB Output is correct
24 Correct 8 ms 8172 KB Output is correct
25 Correct 8 ms 8168 KB Output is correct
26 Correct 21 ms 8940 KB Output is correct
27 Correct 23 ms 9572 KB Output is correct
28 Correct 21 ms 9452 KB Output is correct
29 Correct 22 ms 9452 KB Output is correct
30 Correct 20 ms 9452 KB Output is correct
31 Execution timed out 1056 ms 9728 KB Time limit exceeded
32 Halted 0 ms 0 KB -