제출 #1098319

#제출 시각아이디문제언어결과실행 시간메모리
1098319vjudge1은행 (IZhO14_bank)C++17
19 / 100
185 ms904 KiB
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define S second
#define F first
#define ahah ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

const int N=1e6+7;
const int MOD=1e9+7;

int a[N],b[N];
bool used[N];

signed main() {
	ahah
	int n,m;
	cin >> n >> m;
	for(int i = 1 ; i <= n ; i++){
		cin >> a[i];
	}
	for(int i = 1 ; i <= m ; i++){
		cin >> b[i];
	}
	sort(a+1,a+1+n);
	sort(b+1,b+1+m);
	reverse(b+1,b+1+m);
	map<int,vector<int> >mp;
	for(int i = 0 ; i < (1 << m) ; i++){
		vector<int>vc;
		for(int j = 0 ; j < m ; j++){
			if(i&(1 << j)){
				vc.pb(j+1);
			}
		}
		int cnt=0;
		for(int j = 0 ; j < vc.size() ; j++){
			cnt+=b[vc[j]];
		}
		if(mp[cnt].size() == 0){
			for(int j = 0 ; j < vc.size() ; j++){
				mp[cnt].pb(vc[j]);
			}
		}
	}
	for(int i = 1 ; i <= n ; i++){
		if(mp[a[i]].size() != 0){
		for(int j = 0 ; j < mp[a[i]].size() ; j++){
			if(used[mp[a[i]][j]]){
				cout << "NO";
				return 0;
			}
			else{
				used[mp[a[i]][j]]=true;
			}
		}	
		}else{
			cout << "NO";
			return 0;
		}
	}
	cout << "YES";
}

컴파일 시 표준 에러 (stderr) 메시지

bank.cpp: In function 'int main()':
bank.cpp:37:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |   for(int j = 0 ; j < vc.size() ; j++){
      |                   ~~^~~~~~~~~~~
bank.cpp:41:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |    for(int j = 0 ; j < vc.size() ; j++){
      |                    ~~^~~~~~~~~~~
bank.cpp:48:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |   for(int j = 0 ; j < mp[a[i]].size() ; j++){
      |                   ~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...