제출 #1042995

#제출 시각아이디문제언어결과실행 시간메모리
1042995ALeonidou곤돌라 (IOI14_gondola)C++17
15 / 100
6 ms1748 KiB
#include "gondola.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define F first #define S second #define pb push_back #define endl "\n" #define sz(x) (ll)x.size() typedef vector <ll> vi; typedef pair <ll,ll> ii; typedef vector <ii> vii; #define dbg(x) cout<<#x<<": "<<x<<endl; #define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl; #define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl; void printVct(vi &v){ for (ll i =0; i<sz(v); i++){ cout<<v[i]<<" "; } cout<<endl; } //subtask 1 & 2 int valid(int n, int arr[]){ ll p = 0; for (ll i=1; i<n; i++){ if (arr[p] > arr[i]) p = i; } // if (arr[p] > n) return 1; vi v; for (ll i = p; i<n; i++){ if (arr[i] <= n) v.pb(arr[i]); else v.pb(v.back()+1); } for (ll i =0; i<p; i++){ if (arr[i] <= n) v.pb(arr[i]); else v.pb(v.back()+1); } for (ll i =1; i<n; i++){ if (v[i] != v[i-1] + 1){ return 0; } } return 1; } //---------------------- int replacement(int n, int arr[], int ans[]) { sort(arr, arr+n); ll ans_size = 0; ll c = 1; for (ll i=0; i<n; i++){ while (arr[i] > c){ ans[ans_size] = c; ans_size++; c++; } c++; } return ans_size; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; } /* 1 5 1 2 3 4 5 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...