답안 #570204

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
570204 2022-05-28T20:22:29 Z ChrisM2309 Mountains (NOI20_mountains) C++14
66 / 100
2000 ms 2644 KB
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<ii> vii; 
typedef vector<vii> wgraf;
typedef pair<int,ii> edge;

#define UNVISITED 0
#define VISITED 1
#define INF 1000000000
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()

void RESOLVER(){
    int n;
    cin >> n;
    vector<ll> data(n);
    ll ans = 0;
    for (auto &i : data) cin >> i;
    if (is_sorted(all(data))){
        cout << 0;
        return;
    }
    for (int i = 0; i < n; i++){
        //cout << data[i] << " -- ";
        ll iz = 0, der = 0;
        for (int j = 0; j < i; j++){
            //cout << data[j] << " "; 
            if (data[j]<data[i]) iz++;
        } 
        //cout << " con ";
        for (int j = i + 1; j < n; j++) {
            //cout << data[j] << " "; 
            if (data[j] < data[i]) der++;
        }
        //cout << "\n";
        ans += (iz * der);
    }
    cout << ans; 
    
}
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  //cin >> t;
  while(t--){
    RESOLVER();
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 50 ms 2644 KB Output is correct
3 Correct 50 ms 2644 KB Output is correct
4 Correct 51 ms 2644 KB Output is correct
5 Correct 47 ms 2644 KB Output is correct
6 Correct 47 ms 2644 KB Output is correct
7 Correct 49 ms 2644 KB Output is correct
8 Correct 45 ms 2644 KB Output is correct
9 Correct 50 ms 2644 KB Output is correct
10 Correct 49 ms 2644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2077 ms 2644 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2077 ms 2644 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 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 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 212 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 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 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 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 206 ms 384 KB Output is correct
12 Correct 219 ms 376 KB Output is correct
13 Correct 196 ms 376 KB Output is correct
14 Correct 205 ms 376 KB Output is correct
15 Correct 194 ms 340 KB Output is correct
16 Correct 204 ms 460 KB Output is correct
17 Correct 207 ms 460 KB Output is correct
18 Correct 196 ms 340 KB Output is correct
19 Correct 205 ms 388 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2077 ms 2644 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 50 ms 2644 KB Output is correct
3 Correct 50 ms 2644 KB Output is correct
4 Correct 51 ms 2644 KB Output is correct
5 Correct 47 ms 2644 KB Output is correct
6 Correct 47 ms 2644 KB Output is correct
7 Correct 49 ms 2644 KB Output is correct
8 Correct 45 ms 2644 KB Output is correct
9 Correct 50 ms 2644 KB Output is correct
10 Correct 49 ms 2644 KB Output is correct
11 Execution timed out 2077 ms 2644 KB Time limit exceeded
12 Halted 0 ms 0 KB -