QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#145357 | #6646. 物理实验 | qzez# | WA | 46ms | 4604kb | C++14 | 1.5kb | 2023-08-22 09:26:37 | 2023-08-22 09:26:38 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<typename T>
ostream& operator << (ostream &out,const vector<T>&x){
if(x.empty())return out<<"[]";
out<<'['<<x[0];
for(int len=x.size(),i=1;i<len;i++)out<<','<<x[i];
return out<<']';
}
template<typename T>
vector<T> ary(const T *a,int l,int r){
return vector<T>{a+l,a+1+r};
}
template<typename T>
void debug(T x){
cerr<<x<<'\n';
}
template<typename T,typename ...S>
void debug(T x,S ...y){
cerr<<x<<' ',debug(y...);
}
const int N=6e2+10;
int n,m,a[N],b[N],p[N][N];
int is[N],vis[N],mn[N];
int k,s[N],cur[N];
bool chk(){
for(int i=1;i<=n;i++){
if(is[i])mn[i]=n;
}
fill(vis,vis+1+n,0);
for(int i=1;i<=m;i++){
int x=1;
for(;x<=n&&(is[p[i][x]]||vis[p[i][x]]);x++);
vis[p[i][x]]=1;
for(int j=1;j<=x;j++)if(is[p[i][j]]){
mn[p[i][j]]=min(mn[p[i][j]],a[i]);
}
// debug(i,x);
}
// debug(ary(mn,1,n));
k=0;
for(int i=1;i<=n;i++)if(is[i])cur[++k]=i;
sort(cur+1,cur+1+k,[](int x,int y){
return mn[x]<mn[y];
});
for(int i=1;i<=k;i++)if(mn[cur[i]]<i)return 0;
return 1;
}
int main(){
scanf("%d%d",&n,&m);
for(int i=1;i<=m;i++)scanf("%d",&a[i]);
for(int i=1;i<=m;i++){
for(int j=1;j<=n;j++)scanf("%d",&p[i][j]);
}
is[1]=is[2]=is[4]=is[5]=1;
// debug(chk());
// return 0;
for(int i=1;i<=n;i++){
is[i]=1;
if(!chk())is[i]=0;
}
// debug(ary(is,1,n));
chk();
// debug(chk());
for(int i=1;i<=n-m;i++)printf("%d%c",cur[i],"\n "[i<n-m]);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 18ms
memory: 4372kb
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 207 65 44 111 101 119 116 42 229 41 117 139 171 199 244 272 27 36 94 191 136 62 255 49 99 83 235 178 226 270 43 82 104 95 188 202 151 112 281 166 200 3 258 246 70 102 147 163 131 194 198 206 114 29 227 245 282 115 135 2 267 15 127 120 58 84 263 160 187 50 76 46 184 24 148 93 182 4 92 262 209 14...
result:
ok Correct.
Test #2:
score: 0
Accepted
time: 11ms
memory: 4020kb
input:
600 124 1 12 14 21 22 23 24 26 35 36 40 43 47 52 53 54 55 56 57 62 64 67 71 77 80 81 82 87 88 90 97 99 109 110 112 120 124 133 134 142 143 147 153 154 155 164 166 168 174 183 184 185 188 190 193 196 197 205 208 213 214 232 238 239 253 254 258 259 260 265 266 268 269 270 272 284 286 287 292 293 296 2...
output:
229 323 71 116 122 39 110 395 411 114 179 246 159 20 191 333 311 226 184 252 257 373 162 347 438 140 277 377 390 13 293 366 268 67 189 424 335 332 331 53 309 48 109 258 290 32 38 15 44 137 70 168 244 237 81 84 160 363 302 295 216 319 208 410 200 385 47 414 261 242 361 115 299 138 217 274 357 388 306...
result:
ok Correct.
Test #3:
score: 0
Accepted
time: 19ms
memory: 4352kb
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:
250 108 145 116 148 88 252 171 162 218 170 152 110 179 287 54 188 291 279 136 276 245 87 184 157 2 34 193 173 244 78 119 107 263 29 285 19 264 9 130 83 217 144 100 42 95 262 75 125 186 146 197 224 71 62 123 109 258 248 210 48 169 222 164 211 253 81 23 57 12 51 203 281 241 101 20 231 237 267 214 37 2...
result:
ok Correct.
Test #4:
score: 0
Accepted
time: 6ms
memory: 3952kb
input:
600 84 1 2 20 28 40 43 48 51 55 58 59 75 83 95 105 109 121 125 137 147 153 162 163 165 173 189 193 199 200 212 220 237 242 246 248 250 254 262 281 283 292 295 298 306 307 310 312 314 320 325 326 327 328 329 330 332 333 334 337 341 347 353 362 370 382 384 391 394 395 398 406 416 421 424 445 457 458 4...
output:
97 168 314 388 415 390 108 326 124 138 242 221 166 51 178 11 53 323 161 3 145 180 220 275 237 92 343 37 361 337 442 130 55 228 214 81 170 187 387 327 173 405 202 143 17 351 443 203 31 16 119 496 248 406 386 259 192 209 355 213 315 193 427 324 313 235 459 461 264 116 150 238 120 475 83 293 336 30 12 ...
result:
ok Correct.
Test #5:
score: -100
Wrong Answer
time: 46ms
memory: 4604kb
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:
2 4 5 7 9 11 13 15 17 19 21 23 24 26 28 29 31 33 35 37 39 41 43 45 47 49 51 52 54 56 58 60 62 64 66 68 70 72 73 77 76 75 79 80 83 85 87 89 91 93 95 97 99 101 103 105 106 108 110 112 114 116 118 119 121 123 124 125 127 129 131 132 134 136 138 140 142 144 146 148 150 152 154 156 157 159 160 162 164 16...
result:
FAIL Method not Optimal.