Submission #230705

# Submission time Handle Problem Language Result Execution time Memory
230705 2020-05-11T09:09:39 Z jzh List of Unique Integers (FXCUP4_unique) C++17
100 / 100
5 ms 512 KB
#include "unique.h"
#include<bits/stdc++.h>
using namespace std;
int UniqueCount(int x, int y);
std::vector<int> PickUnique(int N) {
	int i,a[N],b[N],x1,y1,x2,y2;
    for (i=0;i<N;i++){
        a[i] = UniqueCount(0,i);
        b[i] = UniqueCount(i,N-1);
    }
    vector<int>ans;
    for (i=0;i<N;i++){
        if (i>0) x1 = a[i-1];
        else x1 = 0;
        x2 = a[i];
        if (i<N-1) y1 = b[i+1];
        else y1 = 0;
        y2 = b[i];
        if (x1+1 == x2 && y1+1 == y2){
            ans.push_back(1);
        }
        else {
            ans.push_back(0);
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Correct : C = 4
2 Correct 4 ms 384 KB Correct : C = 10
3 Correct 5 ms 384 KB Correct : C = 50
4 Correct 4 ms 384 KB Correct : C = 100
5 Correct 4 ms 384 KB Correct : C = 100
6 Correct 4 ms 384 KB Correct : C = 154
7 Correct 4 ms 384 KB Correct : C = 200
8 Correct 5 ms 512 KB Correct : C = 300
9 Correct 5 ms 512 KB Correct : C = 356
10 Correct 5 ms 512 KB Correct : C = 400
11 Correct 5 ms 512 KB Correct : C = 400
12 Correct 5 ms 512 KB Correct : C = 400
13 Correct 5 ms 512 KB Correct : C = 400
14 Correct 5 ms 512 KB Correct : C = 400
15 Correct 5 ms 512 KB Correct : C = 400