Submission #684517

# Submission time Handle Problem Language Result Execution time Memory
684517 2023-01-21T12:09:08 Z TomitaMatei Subway (info1cup19_subway) C++14
0 / 100
0 ms 212 KB
#include <iostream>
#include <cmath>
using namespace std;
struct arbore
{
    int x,y;

}v[1000001];
int n,k,x,ok,z,i;
int main()
{
    cin>>k;
    x=sqrt(k);
    while ((x+1)*(x+2)/2<=k)
        x++;
    z=k-x*(x+1)/2;
    for (i=0; i<=x; i++)
    {
        if (z==i && z!=0)
        {
            v[i].x=i;
            v[i].y=i-1;
            ok++;
            v[i+ok].x=i+ok;
            v[i+ok].y=i-1;
            i++;
            if (i<=x)
            {
                v[i+ok].x=i+ok;
                v[i+ok].y=i-1;
            }
        }
        else
        {
        v[i+ok].x=i+ok;
        v[i+ok].y=i-1+ok;
        }
    }

    cout<<x+ok<<'\n';
    for (i=0; i<=x+ok; i++)
        cout<<v[i].x<<" "<<v[i].y<<'\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer parameter [name=N] equals to 0, violates the range [1, 1000000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer parameter [name=N] equals to 0, violates the range [1, 1000000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer parameter [name=N] equals to 0, violates the range [1, 1000000]
2 Halted 0 ms 0 KB -