Submission #684519

#TimeUsernameProblemLanguageResultExecution timeMemory
684519TomitaMateiSubway (info1cup19_subway)C++14
100 / 100
8 ms1100 KiB
#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+1<<'\n'; for (i=0; i<=x+ok; i++) cout<<v[i].x<<" "<<v[i].y<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...