# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
217318 | 2020-03-29T11:58:58 Z | jurichhh8 | Konstrukcija (COCI20_konstrukcija) | C++14 | 6 ms | 384 KB |
#include <iostream> #include <cmath> #include <vector> using namespace std; vector<int> veki[1000]; int mx; int main () { long long k; cin>>k; if(k==0){ cout<<5<<" "<<5<<endl<<1<<" "<<2<<endl<<2<<" "<<3<<endl<<2<<" "<<4<<endl<<4<<" "<<5<<endl<<3<<" "<<5; return 0; } int sgn=(k<0); int nep=(k%2); k=abs(k); long long x=log2(k); x++; long long br; if(sgn){ br=k; } else br=pow(2,x)-k; veki[1].push_back(2); veki[1].push_back(3); veki[1].push_back(4); int e=3; for(int i=1;i<x;i++){ veki[3*i-1].push_back(3*i+2); veki[3*i-1].push_back(3*i+3); veki[3*i-1].push_back(3*i+4); veki[3*i].push_back(3*i+2); veki[3*i].push_back(3*i+3); veki[3*i].push_back(3*i+4); veki[3*i+1].push_back(3*i+2); veki[3*i+1].push_back(3*i+3); veki[3*i+1].push_back(3*i+4); e+=9; } br/=2; mx=3*x+2; for(long long i=0;i<x;i++){ if(br & (1<<i)){ if(i%2==0){ veki[1].push_back(mx); veki[mx].push_back(3*(x-i)+1); veki[mx].push_back(3*(x-i)); veki[mx].push_back(3*(x-i)-1); mx++; e+=4; } else{ veki[1].push_back(mx); veki[mx].push_back(3*(x-i)+1); veki[mx].push_back(3*(x-i)); veki[mx].push_back(3*(x-i)-1); mx++; veki[1].push_back(mx); veki[mx].push_back(3*(x-i-1)+1); veki[mx].push_back(3*(x-i-1)); veki[mx].push_back(3*(x-i-1)-1); mx++; e+=8; } } } if(x%2==0){ veki[1].push_back(mx); veki[mx].push_back(2); veki[mx].push_back(3); veki[mx].push_back(4); mx++; e+=4; if(sgn==0){ veki[1].push_back(mx); veki[mx].push_back(2); veki[mx].push_back(3); veki[mx].push_back(4); mx++; e+=4; } } else{ if(sgn){ veki[1].push_back(mx); veki[mx].push_back(2); veki[mx].push_back(3); veki[mx].push_back(4); mx++; e+=4; } } if(nep){ veki[1].push_back(mx); veki[mx].push_back(3*x+1); veki[mx].push_back(3*x-1); veki[mx].push_back(3*x); mx++; veki[1].push_back(mx); veki[mx].push_back(mx+1); mx++; e+=6; } veki[3*x].push_back(mx); veki[3*x-1].push_back(mx); veki[3*x+1].push_back(mx); e+=3; cout<<mx<<" "<<e<<endl; for(int i=1;i<mx;i++){ for(int j=0;j<veki[i].size();j++){ cout<<i<<" "<<veki[i][j]<<endl; } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Correct. |
2 | Correct | 4 ms | 384 KB | Correct. |
3 | Correct | 5 ms | 384 KB | Correct. |
4 | Correct | 5 ms | 384 KB | Correct. |
5 | Correct | 5 ms | 384 KB | Correct. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Correct. |
2 | Correct | 5 ms | 384 KB | Correct. |
3 | Correct | 5 ms | 384 KB | Correct. |
4 | Correct | 5 ms | 384 KB | Correct. |
5 | Correct | 5 ms | 384 KB | Correct. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Correct. |
2 | Correct | 4 ms | 384 KB | Correct. |
3 | Correct | 5 ms | 384 KB | Correct. |
4 | Correct | 5 ms | 384 KB | Correct. |
5 | Correct | 5 ms | 384 KB | Correct. |
6 | Correct | 5 ms | 384 KB | Correct. |
7 | Correct | 5 ms | 384 KB | Correct. |
8 | Correct | 5 ms | 384 KB | Correct. |
9 | Correct | 5 ms | 384 KB | Correct. |
10 | Correct | 5 ms | 384 KB | Correct. |
11 | Correct | 5 ms | 384 KB | Correct. |
12 | Correct | 5 ms | 384 KB | Correct. |
13 | Correct | 5 ms | 384 KB | Correct. |
14 | Correct | 5 ms | 384 KB | Correct. |
15 | Correct | 4 ms | 384 KB | Correct. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Correct. |
2 | Correct | 4 ms | 384 KB | Correct. |
3 | Correct | 5 ms | 384 KB | Correct. |
4 | Correct | 5 ms | 384 KB | Correct. |
5 | Correct | 5 ms | 384 KB | Correct. |
6 | Correct | 5 ms | 384 KB | Correct. |
7 | Correct | 5 ms | 384 KB | Correct. |
8 | Correct | 5 ms | 384 KB | Correct. |
9 | Correct | 5 ms | 384 KB | Correct. |
10 | Correct | 5 ms | 384 KB | Correct. |
11 | Correct | 5 ms | 384 KB | Correct. |
12 | Correct | 5 ms | 384 KB | Correct. |
13 | Correct | 5 ms | 384 KB | Correct. |
14 | Correct | 5 ms | 384 KB | Correct. |
15 | Correct | 4 ms | 384 KB | Correct. |
16 | Incorrect | 6 ms | 384 KB | Wrong answer. |
17 | Halted | 0 ms | 0 KB | - |