QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#225211 | #5095. 九王唱 | chenxinyang2006 | 0 | 1ms | 3728kb | C++14 | 1.6kb | 2023-10-24 08:36:42 | 2023-10-24 08:36:42 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(j);i<=(k);i++)
#define per(i,j,k) for(int i=(j);i>=(k);i--)
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define db double
#define ldb long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define eb emplace_back
#define SZ(S) (int)S.size()
//#define mod 998244353
//#define mod 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3f
using namespace std;
template <class T>
void chkmax(T &x,T y){
if(x < y) x = y;
}
template <class T>
void chkmin(T &x,T y){
if(x > y) x = y;
}
inline int popcnt(int x){
return __builtin_popcount(x);
}
inline int ctz(int x){
return __builtin_ctz(x);
}
/*ll power(ll p,int k = mod - 2){
ll ans = 1;
while(k){
if(k % 2 == 1) ans = ans * p % mod;
p = p * p % mod;
k /= 2;
}
return ans;
}*/
int a[5005][5005];
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 n,seed;
int frp[5005];
int main(){
scanf("%d%d",&n,&seed);
if(!seed){
rep(i,1,n){
rep(j,1,n + 1) scanf("%d",&a[i][j]);
}
}else{
gen(n,seed);
}
rep(p,1,n){
int pos = p - 1;
if(!pos) pos = n;
fill(frp + 1,frp + n + 1,0);
while(1){
int idx = -1;
rep(i,1,n + 1) if(!frp[i] && (idx == -1 || a[pos][i] < a[pos][idx])) idx = i;
frp[idx] = 1;
if(pos == p) break;
pos--;
if(!pos) pos = n;
}
rep(i,1,n + 1) if(!frp[i]) printf("%d ",i);
}
printf("\n");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3728kb
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
result:
wrong answer Answer contains longer sequence [length = 8], but output contains 1 elements
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%