Submission #320889

# Submission time Handle Problem Language Result Execution time Memory
320889 2020-11-10T07:09:30 Z egas Pilot (NOI19_pilot) C++14
0 / 100
1000 ms 9952 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++) {
      |                           ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 9 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 9 ms 8172 KB Output is correct
6 Incorrect 8 ms 8172 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 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 9 ms 8172 KB Output is correct
6 Incorrect 8 ms 8172 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 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 9 ms 8172 KB Output is correct
6 Incorrect 8 ms 8172 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 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 9 ms 8172 KB Output is correct
6 Incorrect 8 ms 8172 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 9092 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 9836 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1033 ms 9952 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 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 9 ms 8172 KB Output is correct
6 Incorrect 8 ms 8172 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 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 9 ms 8172 KB Output is correct
6 Incorrect 8 ms 8172 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 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 9 ms 8172 KB Output is correct
6 Incorrect 8 ms 8172 KB Output isn't correct
7 Halted 0 ms 0 KB -