CF916C Jamie and Interesting Graph

Posted 王宜鸣

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CF916C Jamie and Interesting Graph相关的知识,希望对你有一定的参考价值。

思路:
构造

实现:

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 int main()
 4 {
 5     int n, m;
 6     cin >> n >> m;
 7     cout << "100003 100003" << endl;
 8     for (int i = 0; i < n - 2; i++)
 9     {
10         cout << i + 1 << " " << i + 2 << " " << 1 << endl;
11     }
12     cout << n - 1 << " " << n << " " << 100005 - n << endl;
13     int cnt = 0;
14     for (int i = 1; i <= n; i++)
15     {
16         for (int j = i + 2; j <= n; j++)
17         {
18             if (cnt >= m - n + 1) break;
19             cout << i << " " << j << " 1000000000" << endl;
20             cnt++;
21         }
22     }
23     return 0;
24 }

 

以上是关于CF916C Jamie and Interesting Graph的主要内容,如果未能解决你的问题,请参考以下文章

CF916E Jamie and Tree 解题报告

CF741E Arpa’s abnormal DNA and Mehrdad’s deep interest

Jamie and Alarm Snooze

Jamie and Binary Sequence (changed after round) - CodeForces 916B

CodeForces-916B-Jamie and Binary Sequence(changed after round)(构造)

Codeforces Round #457 (Div. 2) A Jamie and Alarm Snooze