Submission #229742

# Submission time Handle Problem Language Result Execution time Memory
229742 2020-05-06T08:50:51 Z Vimmer Konstrukcija (COCI20_konstrukcija) C++14
30 / 110
33 ms 384 KB
#include <bits/stdc++.h>

//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")

#define F first
#define S second
#define sz(x) ll(x.size())
#define pb push_back
#define N 75005
#define M ll(1e9 + 7)


using namespace std;

typedef long double ld;
typedef long long ll;
typedef short int si;






int main()
{
    ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ll k;

    cin >> k;

    if (k > 0)
    {

        k++;

        cout << 2 + k << " " << k * 2 << endl;

        for (ll i = 1; i <= k; i++) cout << 1 << " " << i + 1 << endl;

        for (ll i = 1; i <= k; i++) cout << i + 1 << " " <<  2 + k << endl;
    }
    else
    {
        for (ll i = 1; i <= 1000; i++)
            for (ll j = 1; j <= 1000; j++)
            {
                if (i * j + j + i > 1000) continue;

                ll m = i * j + j + i, n = i + j + 2;

                ll kr = k + 1 - i - j;

                if (i * j == -kr)
                {
                    cout << n << " " << m << endl;

                    int id = 2;

                    for (int u = 1; u <= i; u++) cout << 1 << " " << id++ << endl;

                    vector <int> gr; gr.clear();

                    for (int b = 1; b <= j; b++)
                    {
                        for (int a = 1; a <= i; a++) cout << a + 1 << " " << id << endl;

                        gr.pb(id);

                        id++;
                    }

                    for (auto it : gr) cout << it << " " << id << endl;

                    exit(0);
                }
            }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Correct.
2 Correct 5 ms 384 KB Correct.
3 Correct 6 ms 384 KB Correct.
4 Correct 5 ms 384 KB Correct.
5 Correct 6 ms 384 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Correct.
2 Correct 6 ms 384 KB Correct.
3 Correct 6 ms 384 KB Correct.
4 Correct 6 ms 384 KB Correct.
5 Correct 7 ms 384 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Correct.
2 Correct 5 ms 384 KB Correct.
3 Correct 6 ms 384 KB Correct.
4 Correct 5 ms 384 KB Correct.
5 Correct 6 ms 384 KB Correct.
6 Correct 5 ms 384 KB Correct.
7 Correct 6 ms 384 KB Correct.
8 Correct 6 ms 384 KB Correct.
9 Correct 6 ms 384 KB Correct.
10 Correct 7 ms 384 KB Correct.
11 Incorrect 33 ms 384 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 6 ms 384 KB Correct.
2 Correct 5 ms 384 KB Correct.
3 Correct 6 ms 384 KB Correct.
4 Correct 5 ms 384 KB Correct.
5 Correct 6 ms 384 KB Correct.
6 Correct 5 ms 384 KB Correct.
7 Correct 6 ms 384 KB Correct.
8 Correct 6 ms 384 KB Correct.
9 Correct 6 ms 384 KB Correct.
10 Correct 7 ms 384 KB Correct.
11 Incorrect 33 ms 384 KB Integer parameter [name=N] equals to 4877, violates the range [1, 1000]
12 Halted 0 ms 0 KB -