Submission #834821

#TimeUsernameProblemLanguageResultExecution timeMemory
834821oscar1fVision Program (IOI19_vision)C++17
59 / 100
10 ms1356 KiB
#include<bits/stdc++.h> #include "vision.h" using namespace std; int nbLig,nbCol,distObj; vector<int> listeLig,listeCol,distLig,distCol; bool estPN(int nb) { int div=2,nbFact=0; while (nb>1) { if (nb%div==0) { while (nb%div==0) { nb/=div; } nbFact++; } div++; } return (nbFact<=1); } vector<int> calcDist(vector<int> val) { vector<int> rep,quest,globQuest; vector<pair<int,int>> listePN; int taille=val.size(),temp; rep.push_back(add_xor(val)); for (int i=1;i<taille;i++) { if (estPN(i)) { //cout<<i<<" "; globQuest.clear(); for (int j=0;j<i;j++) { quest.clear(); for (int k=j;k<taille;k+=i) { quest.push_back(val[k]); } if (quest.size()>1) { globQuest.push_back(add_xor({add_or(quest),add_xor(quest)})); } } listePN.push_back({i,add_or(globQuest)}); temp=add_not(listePN.back().second); } } //cout<<listePN.size()<<endl; for (int i=1;i<taille;i++) { quest.clear(); for (auto div:listePN) { if (i%div.first==0) { quest.push_back(div.second); } else { quest.push_back(div.second+1); } } rep.push_back(add_and(quest)); } return rep; } void construct_network(int H, int W, int K) { nbLig=H; nbCol=W; distObj=K; vector<int> quest; for (int j=0;j<nbCol;j++) { quest.clear(); for (int i=0;i<nbLig;i++) { quest.push_back(i*nbCol+j); } listeCol.push_back(add_or(quest)); } distCol=calcDist(listeCol); for (int i=0;i<nbLig;i++) { quest.clear(); for (int j=0;j<nbCol;j++) { quest.push_back(i*nbCol+j); } listeLig.push_back(add_or(quest)); } distLig=calcDist(listeLig); quest.clear(); for (int i=0;i<nbLig;i++) { for (int j=0;j<nbCol;j++) { if (i+j==distObj) { quest.push_back(add_and({distLig[i],distCol[j]})); } } } add_or(quest); }

Compilation message (stderr)

vision.cpp: In function 'std::vector<int> calcDist(std::vector<int>)':
vision.cpp:26:27: warning: variable 'temp' set but not used [-Wunused-but-set-variable]
   26 |     int taille=val.size(),temp;
      |                           ^~~~
#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...