/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;
void solve(){
ll k;
cin >> k;
ll kel = 0;
vector<pair<int, int>> edge;
int cur = 2;
for(ll i = 1; i <= abs(k) + 1; i++){
edge.push_back({1, cur++});
}
if(k < 0){
for(int i = 2; i < cur; i++){
edge.push_back({i, cur});
edge.push_back({i, cur + 1});
}
edge.push_back({cur, cur + 2});
edge.push_back({cur + 1, cur + 2});
cur = cur + 2;
}else{
for(int i = 2; i < cur; i++){
edge.push_back({i, cur});
}
cur;
}
cout << cur << " " << edge.size() << endl;
for(int i = 0; i < edge.size(); i++){
cout << edge[i].fi << " " << edge[i].se << endl;
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int t = 1;
while(t--){
solve();
}
return 0;
}
Compilation message
konstrukcija.cpp: In function 'void solve()':
konstrukcija.cpp:39:9: warning: statement has no effect [-Wunused-value]
39 | cur;
| ^~~
konstrukcija.cpp:42:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
42 | for(int i = 0; i < edge.size(); i++){
| ~~^~~~~~~~~~~~~
konstrukcija.cpp:21:8: warning: unused variable 'kel' [-Wunused-variable]
21 | ll kel = 0;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Correct. |
2 |
Correct |
1 ms |
348 KB |
Correct. |
3 |
Correct |
1 ms |
348 KB |
Correct. |
4 |
Correct |
1 ms |
348 KB |
Correct. |
5 |
Correct |
2 ms |
348 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Correct. |
2 |
Correct |
1 ms |
348 KB |
Correct. |
3 |
Correct |
2 ms |
472 KB |
Correct. |
4 |
Correct |
1 ms |
348 KB |
Correct. |
5 |
Correct |
2 ms |
348 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Correct. |
2 |
Correct |
1 ms |
348 KB |
Correct. |
3 |
Correct |
1 ms |
348 KB |
Correct. |
4 |
Correct |
1 ms |
348 KB |
Correct. |
5 |
Correct |
2 ms |
348 KB |
Correct. |
6 |
Correct |
1 ms |
348 KB |
Correct. |
7 |
Correct |
1 ms |
348 KB |
Correct. |
8 |
Correct |
2 ms |
472 KB |
Correct. |
9 |
Correct |
1 ms |
348 KB |
Correct. |
10 |
Correct |
2 ms |
348 KB |
Correct. |
11 |
Incorrect |
12 ms |
600 KB |
Integer parameter [name=N] equals to 4877, violates the range [1, 1000] |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Correct. |
2 |
Correct |
1 ms |
348 KB |
Correct. |
3 |
Correct |
1 ms |
348 KB |
Correct. |
4 |
Correct |
1 ms |
348 KB |
Correct. |
5 |
Correct |
2 ms |
348 KB |
Correct. |
6 |
Correct |
1 ms |
348 KB |
Correct. |
7 |
Correct |
1 ms |
348 KB |
Correct. |
8 |
Correct |
2 ms |
472 KB |
Correct. |
9 |
Correct |
1 ms |
348 KB |
Correct. |
10 |
Correct |
2 ms |
348 KB |
Correct. |
11 |
Incorrect |
12 ms |
600 KB |
Integer parameter [name=N] equals to 4877, violates the range [1, 1000] |
12 |
Halted |
0 ms |
0 KB |
- |