1 solutions

  • 0
    @ 2025-12-11 7:44:25
    #include<bits/stdc++.h>
    using namespace std;
    #define int unsigned long long
    pair<int, int>p[1000005];
    int an[1000005];
    int sz[66];
    int vis[66];
    signed main() {
    	int n, m, c, k;
    	cin >> n >> m >> c >> k;
    
    
    	for (int i = 1; i <= n; i++) {
    		cin >> an[i];
    	}
    
    	for (int i = 1; i <= m; i++) {
    		cin >> p[i].first >> p[i].second;
    	}
    
    	for (int i = 0; i < k; i++) {
    		for (int j = 1; j <= n; j++) {
    			sz[i] |= ((an[j] >> i) & 1);
    		}
    	}
    	for (int i = 0; i <= k; i++) {
    //	cout<<sz[i];
    	}
    //cout<<endl;
    	int total = k;
    	for (int i = 1; i <= m; i++) {
    		if (p[i].first < k) {
    			if (sz[p[i].first] == 0 && !vis[p[i].first]) {
    				total--;
    				vis[p[i].first] = 1;
    			}
    
    		}
    
    
    
    	}
    	
    string s;
    int t=ULLONG_MAX;
    s+=t%10+1+'0';
    t/=10;
    
    s=to_string(t)+s;
    	if (total == 64)
    		cout << s;
    
    	else
    		cout << (1ULL << total) - n;
    
    }
    
    
    
    • 1

    Information

    ID
    5
    Time
    2000ms
    Memory
    512MiB
    Difficulty
    10
    Tags
    # Submissions
    7
    Accepted
    2
    Uploaded By