답안 #982673

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
982673 2024-05-14T15:44:50 Z vjudge1 게임 (APIO22_game) C++17
0 / 100
0 ms 596 KB
#include <algorithm>
#include <fstream>
#include <vector>
#include <queue>
#include <stack>
#include <iostream>
#include <cmath>
#include <queue>
#include <set>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <unordered_set>
#define F first
#define S second
#define PB push_back
using namespace std;
const long long MOD=1e9+7, INF=1e18;
const int INFI=1e9;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<pair<int, ii>> viii;
typedef vector<vii> vvii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
/*
class UnionFind{
private:
    vi p, rank;
public:
    void build(int n){
        p.assign(n, 0);    for(int i=0;i<n;i++)    p[i]=i;
        rank.assign(n, 0);
    }
    int findSet(int i){ return (p[i]==i ?   i   :   p[i]=findSet(p[i]));    }
    bool isSameSet(int i, int j){   return findSet(i)==findSet(j);  }
    void unionSet(int i, int j){
        if(isSameSet(i, j)) return;
        int x=findSet(i), y=findSet(j);
        if(rank[x]>rank[y]) swap(x, y);
        p[x]=y;
        if(rank[x]==rank[y])    ++rank[y];
    }
};
vector<UnionFind> UF;
 */
int n, k;
vector<vector<ll>> con;
void init(int N, int K){
    n=N;    k=K;
    con.resize(n, vll(n/60+1, 0));
    for(int i=0;i<k;i++)
        for(int j=i;j<k;j++)
            con[i][j/60]|=((ll)1<<(j%60));
}

int add_teleporter(int u, int v){
    for(int i=0;i<con[u].size();i++)
        con[u][i]|=con[v][i];
    int cnt=0;
    for(int i=0;i<k;i++){
        if(con[u][i/60] & ((ll)1<<i))   cnt=true;
    }
    if(cnt) return 1;
    else    return 0;
}

Compilation message

game.cpp: In function 'int add_teleporter(int, int)':
game.cpp:62:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |     for(int i=0;i<con[u].size();i++)
      |                 ~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 596 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 596 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 596 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 596 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 596 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -