Submission #690906

# Submission time Handle Problem Language Result Execution time Memory
690906 2023-01-30T15:53:23 Z MateiKing80 Subway (info1cup19_subway) C++17
100 / 100
7 ms 724 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int k,i=1;
    cin>>k;
    while(i*(i+1)/2<=k)
        i++;
    i--;
    if(i*(i+1)/2==k)
    {
        cout<<i+1<<'\n';
    cout<<0<<" "<<-1<<'\n';
        for(int j=1;j<=i;j++)
            cout<<j<<" "<<j-1<<'\n';
    }
    else
    {
        cout<<i+2<<'\n';
    cout<<0<<" "<<-1<<'\n';
        for(int j=1;j<=i;j++)
            cout<<j<<" "<<j-1<<'\n';
        cout<<i+1<<" "<<k-(i*(i+1)/2)-1;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 2 ms 300 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 7 ms 724 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 7 ms 724 KB Output is correct
19 Correct 6 ms 596 KB Output is correct
20 Correct 5 ms 548 KB Output is correct