-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathf1.cpp
More file actions
46 lines (34 loc) · 693 Bytes
/
f1.cpp
File metadata and controls
46 lines (34 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "f1.h"
#include <bits/stdc++.h>
typedef long long ll;
#define ff first
#define ss second
#include <iostream>
#include <cstdlib>
using namespace std;
bool F1::run()
{
std::cout << "f1" << std::endl;
int N, K;
N = 10000;
K = 10000;
int total = ((N - 1) * (N - 2)) / 2;
if (K > total)
{
cout << -1 << endl;
return 0;
}
vector<pair<int, int>> edges;
for (int i = 2; i <= N; ++i)
{
edges.push_back({1, i});
}
for (int i = 2; i < N && total > K; ++i)
{
for (int j = i + 1; j <= N && total > K; ++j, --total)
{
edges.push_back({i, j});
}
}
return true;
}