QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#411366 | #8364. permutation | Crysfly | 0 | 14ms | 3632kb | C++17 | 2.8kb | 2024-05-15 12:14:08 | 2024-05-15 12:14:09 |
Judging History
answer
// what is matter? never mind.
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
//#define int long long
#define ull unsigned long long
#define SZ(x) ((int)((x).size()))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;return x;
}
#define mod 998244353
struct modint{
int x;
modint(int o=0){x=o;}
modint &operator = (int o){return x=o,*this;}
modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
modint &operator ^=(int b){
modint a=*this,c=1;
for(;b;b>>=1,a*=a)if(b&1)c*=a;
return x=c.x,*this;
}
modint &operator /=(modint o){return *this *=o^=mod-2;}
friend modint operator +(modint a,modint b){return a+=b;}
friend modint operator -(modint a,modint b){return a-=b;}
friend modint operator *(modint a,modint b){return a*=b;}
friend modint operator /(modint a,modint b){return a/=b;}
friend modint operator ^(modint a,int b){return a^=b;}
friend bool operator ==(modint a,modint b){return a.x==b.x;}
friend bool operator !=(modint a,modint b){return a.x!=b.x;}
bool operator ! () {return !x;}
modint operator - () {return x?mod-x:0;}
bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}
vector<modint> fac,ifac,iv;
inline void initC(int n)
{
if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
int m=iv.size(); ++n;
if(m>=n)return;
iv.resize(n),fac.resize(n),ifac.resize(n);
For(i,m,n-1){
iv[i]=iv[mod%i]*(mod-mod/i);
fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
}
}
inline modint C(int n,int m){
if(m<0||n<m)return 0;
return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 300005
#define inf 0x3f3f3f3f
int n,m,res[maxn];
int pos[11],sta[maxn][11];
signed main()
{
n=read(),m=read();
For(i,1,m){
For(j,1,n)pos[read()]=j;
For(j,1,n){
For(k,j+1,n)
sta[i][j]+=(pos[j]<pos[k]);
For(k,1,j-1)
sta[i][j]-=(pos[j]<pos[i]);
}
}
For(i,1,m)
For(j,1,m){
bool ok=1;
For(k,1,n)
if(sta[i][k]<sta[j][k]) ok=0;
res[i]+=ok;
}
For(i,1,m)cout<<res[i]<<"\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: 14ms
memory: 3632kb
input:
7 2000 5 1 7 4 6 3 2 1 4 6 3 5 2 7 1 3 4 6 2 7 5 6 3 7 1 4 5 2 7 3 6 2 4 1 5 6 7 3 4 1 2 5 6 1 2 5 7 4 3 5 1 4 3 7 6 2 5 3 4 1 2 7 6 7 1 3 4 6 5 2 7 4 6 2 5 1 3 2 6 3 4 1 7 5 5 6 3 1 2 4 7 4 1 6 7 5 3 2 2 6 1 3 7 4 5 1 6 2 3 4 5 7 4 3 1 5 2 7 6 7 3 2 5 4 6 1 2 6 7 1 5 3 4 7 6 2 4 1 5 3 5 1 7 3 6 2 4...
output:
1 1 319 1 1 23 1 67 165 31 8 147 164 13 156 646 291 24 35 8 45 147 3 126 20 26 113 141 108 108 118 6 37 280 23 30 26 119 121 31 21 119 85 30 6 581 8 17 150 17 105 729 1 5 170 15 472 550 395 28 12 155 735 206 14 12 327 19 31 159 40 60 26 126 275 92 104 44 14 13 74 15 87 837 27 23 13 27 7 247 13 233 2...
result:
wrong answer 1st numbers differ - expected: '57', found: '1'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #2:
0%