Submission #247099

# Submission time Handle Problem Language Result Execution time Memory
247099 2020-07-11T05:26:08 Z jamielim List of Unique Integers (FXCUP4_unique) C++17
100 / 100
5 ms 640 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
const int INF=2012345678;
const ll LLINF=4012345678012345678LL;
const ll MOD=1000000007; //998244353; //
const ld PI=3.1415926535898;
const ld EPS=1e-9;
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(b==0)return a;return gcd(b,a%b);}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll expo(ll b,ll p,ll m){ll res=1; while(p){if(p&1)res=(res*b)%m; b=(b*b)%m; p>>=1;} return res;}
inline ll modinv(ll a,ll m){return expo(a,m-2,m);}

#include "unique.h"
//int UniqueCount(int R,int C);

std::vector<int> PickUnique(int N) {
	int c[N][N];
	for(int i=0;i<N;i++){
		c[0][i]=UniqueCount(0,i);
		c[i][N-1]=UniqueCount(i,N-1);
	}
	vector<int> ans;
	for(int i=0;i<N;i++)ans.pb(1);
	for(int i=0;i<N;i++){
		if(i>0&&c[0][i-1]+1!=c[0][i]){
			ans[i]=0;
		}
		if(i<N-1&&c[i+1][N-1]+1!=c[i][N-1]){
			ans[i]=0;
		}
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Correct : C = 4
2 Correct 4 ms 256 KB Correct : C = 10
3 Correct 5 ms 384 KB Correct : C = 50
4 Correct 4 ms 384 KB Correct : C = 100
5 Correct 5 ms 384 KB Correct : C = 100
6 Correct 4 ms 384 KB Correct : C = 154
7 Correct 5 ms 512 KB Correct : C = 200
8 Correct 5 ms 512 KB Correct : C = 300
9 Correct 5 ms 640 KB Correct : C = 356
10 Correct 5 ms 640 KB Correct : C = 400
11 Correct 5 ms 640 KB Correct : C = 400
12 Correct 5 ms 640 KB Correct : C = 400
13 Correct 5 ms 640 KB Correct : C = 400
14 Correct 5 ms 640 KB Correct : C = 400
15 Correct 5 ms 640 KB Correct : C = 400