답안 #39721

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
39721 2018-01-18T02:00:50 Z deletend 곤돌라 (IOI14_gondola) C++14
20 / 100
52 ms 7408 KB
#include <bits/stdc++.h>
#include <gondola.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define mod (ll)(1e9+7)

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int valid(int n, int inputSeq[]) {
  int d = 0, z = -1;
  map<int, int> mp;
  rep(i, 0, n) {
    if(mp[inputSeq[i]]) return 0;
    mp[inputSeq[i]] = 1;
    if(inputSeq[i] <= n) {
      if(z > inputSeq[i]) {
        if(d) return 0;
        else d = 1;
      }
      z = inputSeq[i];
    }
  }
  return 1;
}

int replacement(int n, int gondolaSeq[], int replacementSeq[]) {
  map<int, int> mp;
  int mx = 0;
  rep(i, 0, n) {
    mx = max(mx, gondolaSeq[i]);
    mp[gondolaSeq[i]] = 1;
  }
  int ri = 0;
  rep(i, 1, mx) {
    if(!mp[i]) {
      replacementSeq[ri] = i;
      ri++;
    }
  }
  return ri;
}

int countReplacement(int n, int inputSeq[]) {
  if(!valid(n, inputSeq)) return 0;
  int r[100001];
  if(replacement(n, inputSeq, r) <= n) return 1;

  vector<int> v;
  int no = 0;
  rep(i, 0, n) {
    if(inputSeq[i] > n) v.pb(i);
    else no++;
  }
  return 1;
}
//
// int main() {
//   int n;
//   cin >> n;
//
//   int c[10], h[10], p[10];
//   rep(i, 0, n) cin >> c[i];
//   rep(i, 1, n) cin >> h[i] >> p[i];
//   cout << findSample(n, c, h, p) << endl;
// }
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3580 KB Output is correct
2 Correct 0 ms 3580 KB Output is correct
3 Correct 0 ms 3580 KB Output is correct
4 Correct 0 ms 3580 KB Output is correct
5 Correct 0 ms 3580 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3580 KB Output is correct
2 Correct 0 ms 3580 KB Output is correct
3 Correct 0 ms 3580 KB Output is correct
4 Correct 0 ms 3580 KB Output is correct
5 Correct 0 ms 3580 KB Output is correct
6 Correct 17 ms 5296 KB Output is correct
7 Correct 13 ms 3580 KB Output is correct
8 Correct 30 ms 6880 KB Output is correct
9 Correct 8 ms 4636 KB Output is correct
10 Correct 52 ms 7408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3580 KB Output is correct
2 Correct 0 ms 3580 KB Output is correct
3 Correct 0 ms 3580 KB Output is correct
4 Correct 0 ms 3580 KB Output is correct
5 Correct 0 ms 3580 KB Output is correct
6 Correct 21 ms 5296 KB Output is correct
7 Correct 25 ms 3580 KB Output is correct
8 Correct 34 ms 6880 KB Output is correct
9 Correct 16 ms 4636 KB Output is correct
10 Correct 37 ms 7408 KB Output is correct
11 Correct 0 ms 3580 KB Output is correct
12 Incorrect 0 ms 3580 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3580 KB Output is correct
2 Correct 0 ms 3580 KB Output is correct
3 Correct 0 ms 3580 KB Output is correct
4 Correct 0 ms 3580 KB Output is correct
5 Correct 0 ms 3580 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3580 KB Output is correct
2 Correct 0 ms 3580 KB Output is correct
3 Correct 0 ms 3580 KB Output is correct
4 Correct 0 ms 3580 KB Output is correct
5 Correct 0 ms 3580 KB Output is correct
6 Correct 0 ms 3580 KB Output is correct
7 Incorrect 1 ms 3580 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3580 KB Output is correct
2 Correct 0 ms 3580 KB Output is correct
3 Correct 0 ms 3580 KB Output is correct
4 Correct 0 ms 3580 KB Output is correct
5 Correct 0 ms 3580 KB Output is correct
6 Correct 0 ms 3580 KB Output is correct
7 Incorrect 1 ms 3580 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3848 KB Output is correct
2 Correct 0 ms 3848 KB Output is correct
3 Correct 0 ms 3844 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3844 KB Output is correct
2 Correct 0 ms 3844 KB Output is correct
3 Correct 0 ms 3848 KB Output is correct
4 Correct 0 ms 3848 KB Output is correct
5 Incorrect 0 ms 3848 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3844 KB Output is correct
2 Correct 0 ms 3848 KB Output is correct
3 Correct 0 ms 3848 KB Output is correct
4 Correct 0 ms 3848 KB Output is correct
5 Incorrect 0 ms 3848 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3848 KB Output is correct
2 Correct 0 ms 3844 KB Output is correct
3 Correct 0 ms 3844 KB Output is correct
4 Correct 0 ms 3848 KB Output is correct
5 Incorrect 0 ms 3848 KB Output isn't correct
6 Halted 0 ms 0 KB -