QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#322059 | #4829. Mark on a Graph | alexz1205 | 0 | 0ms | 0kb | C++14 | 1.5kb | 2024-02-06 08:49:15 | 2024-02-06 08:49:15 |
answer
#include <bits/stdc++.h>
using namespace std;
#define nums1 adj[x]
#define nums2 pos.back()
// mark graph in O(n^2+mn)
// check graph
// dfs
const int N = 1000;
vector<set<int>> pos;
set<int> adj[N];
bool dfs(int x, int d = 1){
if (d == 5){
return 1;
}
// set<int>* nums = &adj[i];
set<int> next;
auto i = nums1.begin();
auto j = nums2.begin();
while (i != nums1.end() && j != nums2.end()){
if (*i == *j){
next.insert(next.end(), *i);
}else if (*i > *j){
j ++;
}else {
i ++;
}
}
pos.push_back(next);
for (int v: next){
if (dfs(v, d+1)) return 1;
}
return 0;
}
pair<int, int> edgeCheck[5] = {
{235, 156},
{166, 91},
{538, 650},
{987, 679},
{373, 792}};
set<pair<int, int>> edges;
int main(){
int n, m;
cin >> n >> m;
for (int x = 0; x < m; x ++){
int a, b;
cin >> a >> b;
a --, b --;
adj[a].insert(b);
adj[b].insert(a);
edges.insert({a, b});
edges.insert({b, a});
}
vector<pair<int, int>> change;
for (int x = 0; x < 5; x ++){
if (edges.find(edgeCheck[x]) == edges.end()){
change.push_back(edgeCheck[x]);
}
}
if (change.empty()){
cout << "ok" << endl;
}else {
cout << "mark" << endl;
for (pair<int, int> x: change){
cout << x.first+1 << " " << x.second+1 << endl;
}
}
}
詳細信息
Test #1:
score: 0
Wrong Answer on the first run
input:
1000 3560 603 151 415 20 102 569 895 552 678 734 24 614 689 518 440 223 751 919 223 433 711 551 502 634 706 583 812 501 514 535 780 751 720 530 532 384 888 139 864 791 292 675 171 881 30 592 464 557 280 299 654 650 894 335 250 532 792 10 83 969 118 771 579 300 852 983 243 940 957 939 817 889 911 319...
output:
mark 236 157 167 92 539 651 988 680 374 793
input:
output:
result:
wrong answer Integer parameter [name=k] equals to 236, violates the range [0, 5]