답안 #1018232

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1018232 2024-07-09T16:58:54 Z vjudge1 늑대인간 (IOI18_werewolf) C++17
15 / 100
4000 ms 33104 KB
#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
using vi = vector <int>;

const ll MAXN = 2E5+16;
vll adj[MAXN];
ll vis[MAXN+MAXN];
ll timer = 1;

vi check_validity (int n, vi us, vi vs, vi s, vi e, vi l, vi r) {
    ll Q = s.size();
    for (ll i = 0; i < us.size(); i++) {
        adj[us[i]].push_back(vs[i]);
        adj[vs[i]].push_back(us[i]);
    }
    vi ans(Q);
    for (ll qid = 0; qid < Q; qid++) {
        queue <ll> q;
        q.push(s[qid]);
        timer++;
        while (q.size()) {
            ll u = q.front(); q.pop();
            if (vis[u] == timer) continue;
            vis[u] = timer;
            ll uo = u%MAXN;
            ll lvl = u/MAXN;
            if (l[qid] <= uo && uo <= r[qid] && lvl == 0) {
                q.push(uo+MAXN);
            }
            for (ll v : adj[uo]) {
                if (lvl == 0 && v < l[qid]) continue;
                if (lvl == 1 && v > r[qid]) continue;
                q.push(v+MAXN*lvl);
            }
        }
        ans[qid] = (vis[e[qid]+MAXN] == timer);
    }
    return ans;
}

Compilation message

werewolf.cpp: In function 'vi check_validity(int, vi, vi, vi, vi, vi, vi)':
werewolf.cpp:15:22: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (ll i = 0; i < us.size(); i++) {
      |                    ~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5976 KB Output is correct
2 Correct 2 ms 5980 KB Output is correct
3 Correct 2 ms 5980 KB Output is correct
4 Correct 2 ms 5980 KB Output is correct
5 Correct 2 ms 5980 KB Output is correct
6 Correct 2 ms 5980 KB Output is correct
7 Correct 2 ms 5980 KB Output is correct
8 Correct 1 ms 5980 KB Output is correct
9 Correct 2 ms 5980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5976 KB Output is correct
2 Correct 2 ms 5980 KB Output is correct
3 Correct 2 ms 5980 KB Output is correct
4 Correct 2 ms 5980 KB Output is correct
5 Correct 2 ms 5980 KB Output is correct
6 Correct 2 ms 5980 KB Output is correct
7 Correct 2 ms 5980 KB Output is correct
8 Correct 1 ms 5980 KB Output is correct
9 Correct 2 ms 5980 KB Output is correct
10 Correct 318 ms 6488 KB Output is correct
11 Correct 221 ms 6452 KB Output is correct
12 Correct 11 ms 6232 KB Output is correct
13 Correct 268 ms 6492 KB Output is correct
14 Correct 170 ms 6232 KB Output is correct
15 Correct 240 ms 6492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2884 ms 24728 KB Output is correct
2 Execution timed out 4014 ms 33104 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5976 KB Output is correct
2 Correct 2 ms 5980 KB Output is correct
3 Correct 2 ms 5980 KB Output is correct
4 Correct 2 ms 5980 KB Output is correct
5 Correct 2 ms 5980 KB Output is correct
6 Correct 2 ms 5980 KB Output is correct
7 Correct 2 ms 5980 KB Output is correct
8 Correct 1 ms 5980 KB Output is correct
9 Correct 2 ms 5980 KB Output is correct
10 Correct 318 ms 6488 KB Output is correct
11 Correct 221 ms 6452 KB Output is correct
12 Correct 11 ms 6232 KB Output is correct
13 Correct 268 ms 6492 KB Output is correct
14 Correct 170 ms 6232 KB Output is correct
15 Correct 240 ms 6492 KB Output is correct
16 Correct 2884 ms 24728 KB Output is correct
17 Execution timed out 4014 ms 33104 KB Time limit exceeded
18 Halted 0 ms 0 KB -