Submission #494482

# Submission time Handle Problem Language Result Execution time Memory
494482 2021-12-15T14:34:03 Z ammar2000 Mountains (NOI20_mountains) C++17
64 / 100
2000 ms 8148 KB
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define F first
#define S second
#define coy cout<<"YES\n"
#define con cout<<"NO\n"
#define co1 cout<<"-1\n"
using namespace std;
const int SI=3e5+7;
ll INF=8e18+7;
int MOD=1e9+7;
ll n,a[SI],ans;
int main()
{
   cin>>n;
   for (int i=0;i<n;i++)
    cin>>a[i];
   for (int i=1;i<n-1;i++)
   {
       ll f,s;
       f=s=0;
       for (int r=0;r<i;r++)
        f+=(a[i]>a[r]);
       for(int r=i+1;r<n;r++)
        s+=(a[i]>a[r]);
        ans+=f*s;
   }
   cout <<ans;
   return 0;
}

Compilation message

Mountains.cpp: In function 'int main()':
Mountains.cpp:25:8: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   25 |        for(int r=i+1;r<n;r++)
      |        ^~~
Mountains.cpp:27:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   27 |         ans+=f*s;
      |         ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 2063 ms 8148 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2053 ms 3140 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2053 ms 3140 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 84 ms 540 KB Output is correct
12 Correct 84 ms 460 KB Output is correct
13 Correct 83 ms 544 KB Output is correct
14 Correct 82 ms 544 KB Output is correct
15 Correct 77 ms 540 KB Output is correct
16 Correct 80 ms 460 KB Output is correct
17 Correct 81 ms 460 KB Output is correct
18 Correct 77 ms 536 KB Output is correct
19 Correct 72 ms 400 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2053 ms 3140 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 2063 ms 8148 KB Time limit exceeded
3 Halted 0 ms 0 KB -