제출 #627477

#제출 시각아이디문제언어결과실행 시간메모리
627477inwbear드문 곤충 (IOI22_insects)C++17
0 / 100
164 ms332 KiB
#include "insects.h" #include<bits/stdc++.h> #define pb push_back #define F first #define S second using namespace std; int cc[2005],re,sq; pair<int,int>pos[2005]; bool ins[2005]; int min_cardinality(int N) { re=N; vector<int>v; vector<pair<int,int> >fr; for(int i=0;i<N;i++){ move_inside(i); if(press_button()>1){ move_outside(i); fr.pb({i,false}); } else v.pb(i),ins[i]=true; } if(v.size()!=(int)sqrt(v.size())*(int)sqrt(v.size()))sq=(int)sqrt(v.size())+1; else sq=(int)sqrt(v.size()); for(int i=0;i<v.size();i++)move_outside(v[i]); for(int i=0;i<v.size();i+=sq){ for(int j=i;j<v.size()&&j<i+sq;j++){ move_inside(v[j]); } for(int j=0;j<fr.size();j++){ if(fr[j].S)continue; move_inside(fr[j].F); if(press_button()>1){ fr[j].S=true; pos[fr[j].F].F=i/sq; } move_outside(fr[j].F); } for(int j=i;j<v.size()&&j<i+sq;j++){ move_outside(v[j]); } } for(int i=0;i<sq;i++){ for(int j=i;j<v.size();j+=sq){ move_inside(v[j]); } for(int j=0;j<fr.size();j++){ if(!fr[j].S)continue; move_inside(fr[j].F); if(press_button()>1){ fr[j].S=false; pos[fr[j].F].S=i; } move_outside(fr[j].F); } for(int j=i;j<v.size();j+=sq){ move_inside(v[j]); } } //for(int i=0;i<fr.size();i++)printf("[%d %d]",pos[fr[i].F].F,pos[fr[i].F].S); for(int i=0;i<fr.size();i++){ cc[(pos[fr[i].F].F*sq)+pos[fr[i].F].S]++; } for(int i=0;i<v.size();i++)re=min(re,cc[v[i]]+1); return re; }

컴파일 시 표준 에러 (stderr) 메시지

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:24:14: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |   if(v.size()!=(int)sqrt(v.size())*(int)sqrt(v.size()))sq=(int)sqrt(v.size())+1;
      |      ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
insects.cpp:26:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |   for(int i=0;i<v.size();i++)move_outside(v[i]);
      |               ~^~~~~~~~~
insects.cpp:27:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   for(int i=0;i<v.size();i+=sq){
      |               ~^~~~~~~~~
insects.cpp:28:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int j=i;j<v.size()&&j<i+sq;j++){
      |                 ~^~~~~~~~~
insects.cpp:31:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for(int j=0;j<fr.size();j++){
      |                 ~^~~~~~~~~~
insects.cpp:40:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |     for(int j=i;j<v.size()&&j<i+sq;j++){
      |                 ~^~~~~~~~~
insects.cpp:45:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |     for(int j=i;j<v.size();j+=sq){
      |                 ~^~~~~~~~~
insects.cpp:48:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |     for(int j=0;j<fr.size();j++){
      |                 ~^~~~~~~~~~
insects.cpp:57:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |     for(int j=i;j<v.size();j+=sq){
      |                 ~^~~~~~~~~
insects.cpp:62:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |   for(int i=0;i<fr.size();i++){
      |               ~^~~~~~~~~~
insects.cpp:65:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |   for(int i=0;i<v.size();i++)re=min(re,cc[v[i]]+1);
      |               ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...