제출 #1134713

#제출 시각아이디문제언어결과실행 시간메모리
1134713bpptidpSubway (info1cup19_subway)C++20
100 / 100
5 ms1476 KiB
#include<bits/stdc++.h> using namespace std; int d[(int)1e6+2]; signed main(){ ios::sync_with_stdio(0); cin.tie(0); vector<array<int,2>>g={{0,-1}}; int k; cin>>k; int node=0,av=0; d[0]=0; while(k){ if(av+1<=k){//spawnam novi node g.push_back({++node,node-1}); d[++av]=node; k-=av; }else{ g.push_back({++node,d[k-1]}); break; } } cout<<g.size()<<'\n'; for(auto&[x,y]:g) cout<<x<<' '<<y<<'\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...