QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#796646#7604. Find the VertexCookie_CreammRE 0ms0kbC++201.6kb2024-12-01 23:07:352024-12-01 23:07:36

Judging History

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

  • [2024-12-01 23:07:36]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-12-01 23:07:35]
  • 提交

answer

#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define vt vector
#define pb push_back
#define pii pair<int, int>
#define sz(dq) (int)dq.size()
#define forr(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pll pair<ll, ll>
#define mpp make_pair
#define ALL(v) v.begin(), v.end()
#define ALLR(v) v.rbegin(), v.rend()
#define ld long double
ifstream fin("store.inp");
ofstream fout("store.out");
const ll mxn = 5e5 + 5, inf = 1e9, mod = 998244353, sq = 800, mxv = 1e6 + 5, pr = 37, mod2 = 1e9 + 9, mod3 = 998244353;
//const int x[4] = {0, -1, 0, 1};
 
const int x[4] = {1, -1, 0, 0};
const int y[4] = {0, 0, 1, -1};
//const char dir[4] = {'D', 'U', 'R', 'L'};
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
using u64 = uint64_t;
using u128 = __uint128_t;
int n, m;
int d[mxn + 1];
bool ok[mxn + 1];
void solve(){   
    cin >> n >> m;
    for(int i = 1; i <= n; i++){
        cin >> d[i]; ok[i] = (d[i] == 0);
    }
    for(int i = 0; i < m; i++){
        int u, v; cin >> u >> v;
        ok[v] &= (d[u] == 1); ok[u] &= (d[v] == 1);
    }
    for(int i = 1; i <= n; i++){
        if(ok[i]){
            cout << i; return;
        }
    }
    
}
 
signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("ARRAY.inp", "r", stdin);
    //freopen("ARRAY.out", "w", stdout);
    
    int tt; tt = 1;
    while(tt--){
        solve();
    }
    return(0);
}

詳細信息

Test #1:

score: 0
Dangerous Syscalls

input:

5 6
1 0 1 1 2
5 4
1 2
3 2
3 4
4 2
1 5

output:


result: