QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#105759 | #5095. 九王唱 | zaneyu# | 0 | 0ms | 3740kb | C++23 | 2.4kb | 2023-05-15 11:32:49 | 2024-05-26 02:54:54 |
Judging History
answer
/*input
2 0
1 2 3
1 3 2
*/
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//#pragma GCC target("avx2")
//order_of_key #of elements less than x
// find_by_order kth element
using ll=long long;
using ld=long double;
using pii=pair<int,int>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()),c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll maxn=5e3+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const int MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-4;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
out<<P.f<<' '<<P.s;
return out;
}
template<typename T>
ostream& operator<<(ostream& out,vector<T> V){
REP(i,sz(V)) out<<V[i]<<((i!=sz(V)-1)?"\n":"");
return out;
}
ll mult(ll a,ll b){
return a*b%MOD;
}
ll mypow(ll a,ll b){
a%=MOD;
if(a==0) return 0;
if(b<=0) return 1;
ll res=1LL;
while(b){
if(b&1) res=(res*a)%MOD;
a=(a*a)%MOD;
b>>=1;
}
return res;
}
int a[maxn][maxn];
bool lft[maxn];
void gen(int n,int seed){
std::mt19937 rnd(seed);
for(int i=1;i<=n;++i){
for(int j=1;j<=n+1;++j){
a[i][j]=j;
std::swap(a[i][j],a[i][rnd()%j+1]);
}
}
}
int main(){
ios::sync_with_stdio(false),cin.tie(0);
int n,seed;
cin>>n>>seed;
if(seed){
gen(n,seed);
}
else{
REP(i,n){
REP(j,n+1){
cin>>a[i][j];
}
}
}
REP(p,n){
REP1(i,n+1) lft[i]=1;
REP(i,n){
int x=(p-i-1+n)%n;
REP(j,n+1){
if(lft[a[x][j]]){
lft[a[x][j]]=0;
break;
}
}
}
REP1(i,n+1){
if(lft[i]) cout<<i<<' ';
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 8
Accepted
time: 0ms
memory: 3612kb
input:
8 0 6 1 3 2 9 7 8 4 5 6 1 3 2 9 7 8 4 5 6 1 3 2 9 7 8 4 5 6 1 3 2 9 7 8 4 5 6 1 3 2 9 7 8 4 5 6 1 3 2 9 7 8 4 5 6 1 3 2 9 7 8 4 5 6 1 3 2 9 7 8 4 5
output:
5 5 5 5 5 5 5 5
result:
ok 8 numbers
Test #2:
score: -8
Wrong Answer
time: 0ms
memory: 3740kb
input:
8 0 4 7 8 6 1 3 2 9 5 5 8 9 7 2 4 3 1 6 6 9 1 8 3 5 4 2 7 7 1 2 9 4 6 5 3 8 8 2 3 1 5 7 6 4 9 9 3 4 2 6 8 7 5 1 1 4 5 3 7 9 8 6 2 2 5 6 4 8 1 9 7 3
output:
3 3 3 3 3 3 3 3
result:
wrong answer 1st numbers differ - expected: '7', found: '3'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%