# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
88799 | 2018-12-08T19:57:00 Z | shafinalam | 학생 (COCI14_studentsko) | C++14 | 4 ms | 984 KB |
#include <bits/stdc++.h> using namespace std; const int mx = 1e5+5; typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; typedef pair<int,int>pii; typedef pair<int,pii>piii; #define sf scanf #define pf printf #define input freopen("input.txt","r",stdin) #define output freopen("output.txt","w",stdout) #define inf 1e16 #define ff first #define ss second #define MP make_pair #define pb push_back #define all(v) v.begin(), v.end() #define printcase(cases) printf("Case %d:", cases); #define Unique(a) a.erase(unique(a.begin(),a.end()),a.end()) #define FAST ios_base::sync_with_stdio(0);cout.tie(0) #define endl printf("\n") #define __lcm(a, b) ((a*b)/__gcd(a, b)) int Set(int N,int pos){return N=N | (1<<pos);} int reset(int N,int pos){return N= N & ~(1<<pos);} bool check(int N,int pos){return (bool)(N & (1<<pos));} int arr[mx]; int tmp[mx]; int id[mx]; int dp[mx]; vector<int>v; int main() { int n, k; sf("%d%d", &n, &k); for(int i = 0; i < n; i++) { sf("%d", &arr[i]); tmp[i] = arr[i]; } sort(tmp, tmp+n); for(int i = 0; i < n; i++) id[tmp[i]] = i/k; for(int i = 0; i < n; i++) v.push_back(id[arr[i]]); int boro = 0; dp[0] = 1; for(int i = 1; i < n; i++) { dp[i] = 1; for(int j = 0; j < i; j++) { if(v[j]<=v[i]) dp[i] = max(dp[i], dp[j]+1); } boro = max(boro, dp[i]); } int ans = n-boro; pf("%d\n", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 376 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 648 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 668 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 804 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 956 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 980 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 980 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 984 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 984 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 984 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |