# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
392682 | Ruxandra985 | Teams (CEOI11_tea) | C++14 | 2578 ms | 76316 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define DIMN 1000010
using namespace std;
int dp[DIMN];
int mp[DIMN];
pair <int , int> v[DIMN];
int main()
{
FILE *fin = stdin;
FILE *fout = stdout;
int n , i , now , st , dr , mid , cnt;
fscanf (fin,"%d",&n);
for (i = 1 ; i <= n ; i++){
fscanf (fin,"%d",&v[i].first);
v[i].second = i;
}
sort (v + 1 , v + n + 1);
for (i = 1 ; i <= n ; i++){
if (i - v[i].first < 0){
dp[i] = -2000000000;
mp[i] = mp[i - 1];
}
else {
dp[i] = mp[i - v[i].first] + 1;
mp[i] = max(mp[i - 1] , dp[i]);
}
}
fprintf (fout,"%d\n" , dp[n]);
now = n;
while (now){ /// nu pare o idee buna ce fac....
st = v[now].first;
dr = now;
while (st <= dr){
mid = (st + dr) / 2;
if (mp[now - mid] + 1 != dp[now]) /// nu e bun
st = mid + 1;
else dr = mid - 1;
}
/// solutia e in dr (ultimul care se poate)
fprintf (fout,"%d " , st);
for (i = 1 ; i <= st ; i++ , now--){
fprintf (fout,"%d ",v[now].second);
}
fprintf (fout,"\n");
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |