답안 #964080

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
964080 2024-04-16T09:40:54 Z oblantis 늑대인간 (IOI18_werewolf) C++17
컴파일 오류
0 ms 0 KB
//#pragma gcc target("avx2,bmi,bmi2,lzcnt,popcnt")
//#pragma gcc optimize("o3,unroll-loops")
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define pb push_back
#define ss second
#define ff first
#define vt vector
#define uid(a, b) uniform_int_distribution<int>(a, b)(mt)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll inf = 1e18;
const int mod = 1e9+7;
const int maxn = 2e5;
mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
void solve() {
    
}
#include "werewolf.h"
vt<int> s[maxn], g[maxn], eg[maxn], g[maxn];
int n, q, m, i1[maxn], i2[maxn], p[maxn], sz[maxn], cnt, xl[maxn], xr[maxn];
bool was[maxn];
int get(int v){
    if(p[v] == v)return v;
    return (p[v] = get(p[v]));
}
void go(int v){
    i1[v] = cnt++;
    was[v] = 1;
    for(auto i : g[v]){
        if(!was[i]){
            go(i);
        }
    }
}
int cl(int v){
    if(v == -1 || xl[v] == v)return v;
    return (xl[v] = cl(xl[v]));
}
int cr(int v){
    if(v == n || xr[v] == v)return v;
    return (xr[v] = cr(xr[v]));
}
vt<int> check_validity(int n, vt<int> x, vt<int> y,
                                vt<int> s, vt<int> e,
                                vt<int> l, vt<int> r) {
    n = n, q = s.size(), m = x.size();
    vt<int> a(q, 0);
    for(int i = 0; i < q; ++i) {
        s[l[i]].pb(i);
    }
    for(int i = 0; i < m; i++){
        if(y[i] > x[i])swap(x[i], y[i]);
        g[x[i]].pb(y[i]);
        eg[y[i]].pb(x[i]);
    }
    for(int i = 0; i < n; i++){
        p[i] = sz[i] = -1;
    }
    for(int i = n - 1; i >= 0; i--){
        p[i] = i, sz[i] = 1;
        for(auto j : g[i]){
            int u = get(i), v = get(j);
            if(u == v)continue;
            g[i].pb(j);
            if(sz[u] > sz[v])swap(u, v);
            p[u] = v, sz[v] += sz[u];
        }
    }
    for(int i = 0; i < n; i++){
        if(!was[i]){
            go(i);
        }
        xl[i] = xr[i] = i;
    } 
    for(int i = n - 1; i >= 0; i--){
        xl[i1[i]] = i1[i] - 1;
        xr[i1[i]] = i1[i] + 1;
        cl(i1[i]);
        cr(i1[i]);
        for(auto j : s[i]){
            cl(i1[s[j]]), cr(i1[s[j]]);
            rng1[j] = {xl[i1[s[j]]] + 1, xr[i1[s[j]]] - 1};
        }
    }
    return a;
}
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int times = 1; //cin >> times;
	for(int i = 1; i <= times; i++) {
		solve();
	}
	return 0;
}

Compilation message

werewolf.cpp:22:37: error: redefinition of 'std::vector<int> g [200000]'
   22 | vt<int> s[maxn], g[maxn], eg[maxn], g[maxn];
      |                                     ^
werewolf.cpp:22:18: note: 'std::vector<int> g [200000]' previously declared here
   22 | vt<int> s[maxn], g[maxn], eg[maxn], g[maxn];
      |                  ^
werewolf.cpp: In function 'std::vector<int> check_validity(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:5:12: error: request for member 'push_back' in 's.std::vector<int>::operator[](((std::vector<int>::size_type)l.std::vector<int>::operator[](((std::vector<int>::size_type)i))))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
    5 | #define pb push_back
      |            ^~~~~~~~~
werewolf.cpp:52:17: note: in expansion of macro 'pb'
   52 |         s[l[i]].pb(i);
      |                 ^~
werewolf.cpp:83:25: error: 'begin' was not declared in this scope
   83 |         for(auto j : s[i]){
      |                         ^
werewolf.cpp:83:25: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from werewolf.cpp:3:
/usr/include/c++/10/valarray:1224:5: note:   'std::begin'
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from werewolf.cpp:3:
/usr/include/c++/10/bits/fs_dir.h:549:3: note:   'std::filesystem::__cxx11::begin'
  549 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
werewolf.cpp:83:25: error: 'end' was not declared in this scope
   83 |         for(auto j : s[i]){
      |                         ^
werewolf.cpp:83:25: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from werewolf.cpp:3:
/usr/include/c++/10/valarray:1244:5: note:   'std::end'
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from werewolf.cpp:3:
/usr/include/c++/10/bits/fs_dir.h:554:3: note:   'std::filesystem::__cxx11::end'
  554 |   end(recursive_directory_iterator) noexcept
      |   ^~~
werewolf.cpp:85:13: error: 'rng1' was not declared in this scope
   85 |             rng1[j] = {xl[i1[s[j]]] + 1, xr[i1[s[j]]] - 1};
      |             ^~~~