QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#418884#6646. 物理实验LinkWish#WA 22ms4208kbC++141.4kb2024-05-23 16:18:292024-05-23 16:18:30

Judging History

你现在查看的是最新测评结果

  • [2024-05-23 16:18:30]
  • 评测
  • 测评结果:WA
  • 用时:22ms
  • 内存:4208kb
  • [2024-05-23 16:18:29]
  • 提交

answer

//Linkwish's code
#include<bits/stdc++.h>
#define endl '\n'
#define si static inline
#define mp make_pair
#define fi first
#define se second
using namespace std;typedef long long ll;typedef __int128 li;
typedef pair<int,int> pii;typedef pair<ll,ll> pll;typedef const int ci;
typedef const ll cl;const int iinf=INT_MAX;const ll linf=LLONG_MAX;
template<typename T>si bool gmax(T &x,const T y){if(x<y)return x=y,1;return 0;}
template<typename T>si bool gmin(T &x,const T y){if(y<x)return x=y,1;return 0;}

namespace LinkWish{
	const int N=605;int n,m,a[N],p[N][N];bool vi[N],Vi[N];
	bool check(int x){
		memset(Vi,0,sizeof(Vi));
		for(int sum=0,i=1;i<=m;i++){
			for(int j=1;vi[p[i][j]]||p[i][j]==x;j++)if(!Vi[p[i][j]])Vi[p[i][j]]=1,sum++;
			if(sum>a[i])return 0;
		}return 1;
	}
	void mian(){
		cin>>n>>m;
		for(int i=1;i<=m;i++)cin>>a[i];
		for(int i=1;i<=m;i++){
			for(int j=1;j<=n;j++)cin>>p[i][j];
		}
		for(int j=1,i=1;i<=n-m;i++){
			while(!check(j))j++;
			vi[j]=1,j++;
		}
		memset(Vi,0,sizeof(Vi));
		for(int sum=0,i=1;i<=m;i++){
			int j=1;
			for(;vi[p[i][j]]||Vi[p[i][j]];j++)if(!Vi[p[i][j]])Vi[p[i][j]]=1,cout<<p[i][j]<<" ";
			Vi[p[i][j]]=1;
		}
		for(int i=1;i<=n;i++)if(!Vi[i])cout<<i<<" ";
	}
}

signed main(){
	#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	#endif
//	ios::sync_with_stdio(0);
//	cin.tie(0),cout.tie(0);
	LinkWish::mian();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 22ms
memory: 4208kb

input:

600 299
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

9 17 65 44 111 207 116 101 42 119 280 229 41 117 139 171 244 272 199 27 36 191 94 136 62 49 255 99 83 235 178 226 270 82 43 104 95 188 202 296 291 131 187 112 151 281 166 200 3 258 246 301 38 70 102 147 163 194 198 206 114 303 245 29 282 227 158 285 115 2 135 15 267 127 120 58 263 84 160 148 46 184 ...

result:

FAIL Method Invalid.