답안 #988162

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
988162 2024-05-24T07:37:53 Z vjudge1 Konstrukcija (COCI20_konstrukcija) C++11
30 / 110
2 ms 604 KB
#include<bits/stdc++.h>
using namespace std;
 
#pragma GCC optimize("O3","unroll-loops")
#pragma GCC target("bmi,bmi2,lzcnt,popcnt")
 
// // PBDS Template
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <class T>
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
//using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
// Preset
const int maxn = 1000000;
const int INF = INT_MAX;
const long long int LINF = LLONG_MAX;
const long long int mod = 1e9 + 7;
const long long int mod2 = 998244353;
const double e = 2.71828;
const double PI = acos(-1);
const double eps = 1e-10;
#define pb push_back
#define ll long long
#define ull unsigned long long
#define ld double
#define all(x) (x.begin(), x.end())
typedef pair<char,char> pc;
typedef pair<double,double> pdb;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<pi,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<string,int> psi;
typedef pair<int,string> pis;
typedef pair<char,int> pci;
typedef pair<int,char> pic;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
int dr[4] = {0,1,0,-1}, dc[4] = {1,0,-1,0};
 
 
void solve() {
	int k;
	cin >> k;
	if (k<500 && k>0) {
		int node = k+3;
		int edge = 2*(k+1);
		cout << node << ' ' << edge << '\n';
		for (int i=2; i<node; i++) {
			cout << 1 << ' ' << i << '\n';
		}
		for (int i=2; i<node; i++) {
			cout << i << ' ' << node << '\n';
		}
	}
	else if (k==0) {
		cout << "3 2" << '\n';
		cout << "1 2" << '\n';
		cout << "1 3" << '\n';
	}
	else if (k > -300) {
		int node = 42;
		vector<pi> v;
		for (int i=20; i<40; i++) {
			for (int j=2; j<22; j++) {
				int x = j+i;
				if (x > 41) x -= 20;
				v.pb({j, x});
			}
		}
//		cout << v.size() << '\n';
		int curbal = -361;
		while (curbal < k) {
//			cout << curbal << ' ' << k << '\n';
			v.pop_back();
			curbal++;
		}
		cout << node << ' ' << (int)(v.size()) + 40 << '\n';
		for (int i=2; i<22; i++) cout << 1 << ' ' << i << '\n';
		for (int i=22; i<node; i++) cout << i << ' ' << node << '\n';
		for (auto x : v) cout << x.first << ' ' << x.second << '\n';
	}
}
 
int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
//	precompute();
//	FFT::init_fft();
    int tc = 1;
//	cin >> tc;
//	getchar();
//	int idx = 1;
	while (tc--) solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Correct.
2 Correct 1 ms 600 KB Correct.
3 Correct 1 ms 344 KB Correct.
4 Correct 1 ms 348 KB Correct.
5 Correct 1 ms 348 KB Correct.
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 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 1 ms 348 KB Correct.
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Correct.
2 Correct 1 ms 600 KB Correct.
3 Correct 1 ms 344 KB Correct.
4 Correct 1 ms 348 KB Correct.
5 Correct 1 ms 348 KB Correct.
6 Correct 1 ms 344 KB Correct.
7 Correct 1 ms 348 KB Correct.
8 Correct 1 ms 348 KB Correct.
9 Correct 1 ms 348 KB Correct.
10 Correct 1 ms 348 KB Correct.
11 Runtime error 2 ms 604 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Correct.
2 Correct 1 ms 600 KB Correct.
3 Correct 1 ms 344 KB Correct.
4 Correct 1 ms 348 KB Correct.
5 Correct 1 ms 348 KB Correct.
6 Correct 1 ms 344 KB Correct.
7 Correct 1 ms 348 KB Correct.
8 Correct 1 ms 348 KB Correct.
9 Correct 1 ms 348 KB Correct.
10 Correct 1 ms 348 KB Correct.
11 Runtime error 2 ms 604 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -