# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
472274 | elgamalsalman | Political Development (BOI17_politicaldevelopment) | C++14 | 67 ms | 4516 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
int n, k;
bool foundTriple = 0, foundDouble = 0;
vvi adj;
bitset<5005> adjMatrix[5005];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> k;
adj.assign(n + 20, vi());
for (int i = 0; i < n; i++) {
int d; cin >> d;
while (d--) {
foundDouble = 1;
int v; cin >> v;
adj[i].push_back(v);
adj[v].push_back(i);
adjMatrix[i][v] = 1;
adjMatrix[v][i] = 1;
}
}
for (int i = 0; !foundTriple && i < n; i++) {
for (int j = 0; !foundTriple && j < adj[i].size(); j++) {
for (int k = j + 1; !foundTriple && k < adj[i].size(); k++) {
int jj = adj[i][j];
int kk = adj[i][k];
if (adjMatrix[jj][kk]) {
foundTriple = 1;
//cerr << "// " << i << ", " << jj << ", " << kk << "\n";
}
}
}
}
if (foundTriple) cout << "3\n";
else if (foundDouble) cout << "2\n";
else cout << "1\n";
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |