# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
388927 | 2021-04-13T10:16:34 Z | DylanP | 은행 (IZhO14_bank) | C++14 | 136 ms | 428 KB |
#include<bits/stdc++.h> using namespace std; int main(){ int N,M,a; scanf("%d %d",&M,&N); vector<int> w; vector<int> bill_nye; for(int i=0;i<M;i++){ scanf("%d",&a); bill_nye.push_back(a); } for(int i=0;i<N;i++){ scanf("%d",&a); w.push_back(a); } int EXP=1<<N; vector<bool> bitmask; bitmask.resize(EXP); bitmask[0]=true; int wrestler=0; vector<int> L; for(int i=0;i<M;i++){ for(int j=0;j<bill_nye[i];j++){ L.push_back(i); wrestler++; } } for(int i=0;i<N;i++){ for(int j=0;j<w[i];j++){ L.push_back(299792458); } } vector<int> YTP; for(int i=1;i<EXP;i*=2){ YTP.push_back(INT_MAX-i); } for(int i=1;i<EXP;i++){ bitmask[i]=false; int sumo=0; for(int j=0;j<N;j++){ if((i>>j)%2){ sumo+=w[j]; } } for(int j=0;j<N;j++){ if(L[sumo-1]==L[sumo-w[j]-1]){ if(bitmask[i&YTP[j]]){ bitmask[i]=true; if(sumo==wrestler){ wrestler=-314159265; } } } } } if(wrestler<0){ cout<<"YES"; }else{ cout<<"NO"; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 4 ms | 248 KB | Output is correct |
5 | Correct | 125 ms | 420 KB | Output is correct |
6 | Correct | 1 ms | 288 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 115 ms | 428 KB | Output is correct |
9 | Correct | 136 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 292 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 292 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 4 ms | 248 KB | Output is correct |
5 | Correct | 125 ms | 420 KB | Output is correct |
6 | Correct | 1 ms | 288 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 115 ms | 428 KB | Output is correct |
9 | Correct | 136 ms | 332 KB | Output is correct |
10 | Incorrect | 1 ms | 292 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |