Submission #986405

#TimeUsernameProblemLanguageResultExecution timeMemory
986405PyqeVision Program (IOI19_vision)C++17
100 / 100
14 ms2036 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; long long nn,ma=8,pst[2][8]; void construct_network(int n, int m, int d) { long long i,j,ii,iii,k,p,tg,tg2,tg3,ls; vector<int> v; nn=n*m; add_not(nn-1); nn++; v={nn-2,nn-1}; add_and(v); nn++; add_not(nn-1); nn++; for(ii=0;ii<2;ii++) { tg2=nn; for(i=0;i<n;i++) { v.clear(); for(j=0;j<m;j++) { if(ii) { swap(i,j); swap(n,m); } p=i*m+j; v.push_back(p); if(ii) { swap(i,j); swap(n,m); } } add_xor(v); nn++; } tg=tg2; tg2=nn; for(i=1;i<n;i++) { v.clear(); for(j=0;j<i;j++) { v.push_back(tg+j); } add_xor(v); nn++; } ls=n*m+1; for(i=0;i<ma;i++) { pst[ii][i]=n*m+1; } for(i=0;1ll<<i<n;i++) { tg=tg2; v={ls}; for(j=0;j<n-1>>i;j++) { v.push_back(tg+j); } add_xor(v); nn++; pst[ii][i]=nn-1; add_not(nn-1); nn++; tg2=nn; for(j=1;j<n-1>>i;j+=2) { v={tg+j-1,tg+j}; add_and(v); nn++; } tg3=nn; for(j=0;j<n-1>>i;j++) { k=tg2+j/2; if(j/2>=n-1>>i+1) { k=n*m+1; } v={tg+j,k}; add_xor(v); nn++; } tg=tg3; v.clear(); for(j=0;j<n-1>>i;j++) { v.push_back(tg+j); } add_xor(v); nn++; add_or(v); nn++; v={nn-2,nn-1}; add_xor(v); nn++; for(iii=0;iii<2;iii++) { v={ls+!iii,nn-1-iii*2}; add_and(v); nn++; } v={nn-2,nn-1}; add_or(v); nn++; ls=nn-1; add_not(nn-1); nn++; } swap(n,m); } tg2=nn; for(i=0;i<=d;i++) { v.clear(); for(ii=0;ii<2;ii++) { for(j=0;j<ma;j++) { v.push_back(pst[ii][j]+!(i>>j&1)); } i=d-i; } add_and(v); nn++; } tg=tg2; v.clear(); for(i=0;i<=d;i++) { v.push_back(tg+i); } add_or(v); nn++; }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:16:7: warning: narrowing conversion of '(nn - 2)' from 'long long int' to 'int' [-Wnarrowing]
   16 |  v={nn-2,nn-1};
      |     ~~^~
vision.cpp:16:7: warning: narrowing conversion of '(nn - 2)' from 'long long int' to 'int' [-Wnarrowing]
vision.cpp:16:12: warning: narrowing conversion of '(nn - 1)' from 'long long int' to 'int' [-Wnarrowing]
   16 |  v={nn-2,nn-1};
      |          ~~^~
vision.cpp:16:12: warning: narrowing conversion of '(nn - 1)' from 'long long int' to 'int' [-Wnarrowing]
vision.cpp:65:7: warning: narrowing conversion of 'ls' from 'long long int' to 'int' [-Wnarrowing]
   65 |    v={ls};
      |       ^~
vision.cpp:65:7: warning: narrowing conversion of 'ls' from 'long long int' to 'int' [-Wnarrowing]
vision.cpp:66:15: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
   66 |    for(j=0;j<n-1>>i;j++)
      |              ~^~
vision.cpp:76:15: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
   76 |    for(j=1;j<n-1>>i;j+=2)
      |              ~^~
vision.cpp:78:12: warning: narrowing conversion of '((tg + j) - 1)' from 'long long int' to 'int' [-Wnarrowing]
   78 |     v={tg+j-1,tg+j};
      |        ~~~~^~
vision.cpp:78:12: warning: narrowing conversion of '((tg + j) - 1)' from 'long long int' to 'int' [-Wnarrowing]
vision.cpp:78:17: warning: narrowing conversion of '(tg + j)' from 'long long int' to 'int' [-Wnarrowing]
   78 |     v={tg+j-1,tg+j};
      |               ~~^~
vision.cpp:78:17: warning: narrowing conversion of '(tg + j)' from 'long long int' to 'int' [-Wnarrowing]
vision.cpp:83:15: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
   83 |    for(j=0;j<n-1>>i;j++)
      |              ~^~
vision.cpp:86:19: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   86 |     if(j/2>=n-1>>i+1)
      |                  ~^~
vision.cpp:90:10: warning: narrowing conversion of '(tg + j)' from 'long long int' to 'int' [-Wnarrowing]
   90 |     v={tg+j,k};
      |        ~~^~
vision.cpp:90:10: warning: narrowing conversion of '(tg + j)' from 'long long int' to 'int' [-Wnarrowing]
vision.cpp:90:13: warning: narrowing conversion of 'k' from 'long long int' to 'int' [-Wnarrowing]
   90 |     v={tg+j,k};
      |             ^
vision.cpp:90:13: warning: narrowing conversion of 'k' from 'long long int' to 'int' [-Wnarrowing]
vision.cpp:96:15: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
   96 |    for(j=0;j<n-1>>i;j++)
      |              ~^~
vision.cpp:104:9: warning: narrowing conversion of '(nn - 2)' from 'long long int' to 'int' [-Wnarrowing]
  104 |    v={nn-2,nn-1};
      |       ~~^~
vision.cpp:104:9: warning: narrowing conversion of '(nn - 2)' from 'long long int' to 'int' [-Wnarrowing]
vision.cpp:104:14: warning: narrowing conversion of '(nn - 1)' from 'long long int' to 'int' [-Wnarrowing]
  104 |    v={nn-2,nn-1};
      |            ~~^~
vision.cpp:104:14: warning: narrowing conversion of '(nn - 1)' from 'long long int' to 'int' [-Wnarrowing]
vision.cpp:109:10: warning: narrowing conversion of '(ls + (iii == 0))' from 'long long int' to 'int' [-Wnarrowing]
  109 |     v={ls+!iii,nn-1-iii*2};
      |        ~~^~~~~
vision.cpp:109:10: warning: narrowing conversion of '(ls + (iii == 0))' from 'long long int' to 'int' [-Wnarrowing]
vision.cpp:109:20: warning: narrowing conversion of '((nn - 1) - (iii * 2))' from 'long long int' to 'int' [-Wnarrowing]
  109 |     v={ls+!iii,nn-1-iii*2};
      |                ~~~~^~~~~~
vision.cpp:109:20: warning: narrowing conversion of '((nn - 1) - (iii * 2))' from 'long long int' to 'int' [-Wnarrowing]
vision.cpp:113:9: warning: narrowing conversion of '(nn - 2)' from 'long long int' to 'int' [-Wnarrowing]
  113 |    v={nn-2,nn-1};
      |       ~~^~
vision.cpp:113:9: warning: narrowing conversion of '(nn - 2)' from 'long long int' to 'int' [-Wnarrowing]
vision.cpp:113:14: warning: narrowing conversion of '(nn - 1)' from 'long long int' to 'int' [-Wnarrowing]
  113 |    v={nn-2,nn-1};
      |            ~~^~
vision.cpp:113:14: warning: narrowing conversion of '(nn - 1)' from 'long long int' to 'int' [-Wnarrowing]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...