Submission #998700

#TimeUsernameProblemLanguageResultExecution timeMemory
9987008pete8Minerals (JOI19_minerals)C++17
6 / 100
6 ms600 KiB
#include "minerals.h" #include<iostream> #include<stack> #include<map> #include<vector> #include<string> #include<cassert> #include<unordered_map> #include <queue> #include <cstdint> #include<cstring> #include<limits.h> #include<cmath> #include<set> #include<algorithm> #include <iomanip> #include<numeric> #include<bitset> using namespace std; #define ll long long #define f first #define s second #define pii pair<int,int> #define ppii pair<int,pii> #define vi vector<int> #define pb push_back #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define F(n) for(int i=0;i<n;i++) #define lb lower_bound #define ub upper_bound #define fastio ios::sync_with_stdio(false);cin.tie(NULL); #pragma GCC optimize ("03,unroll-lopps") void Solve(int n){ int root=sqrt(n); vector<int>done(2*n+1,0); int cnt=0; while(cnt!=2*n){ set<int>v; int last=0,yes=0; for(int i=1;i<=2*n;i++){ if(done[i])continue; int x=Query(i); if(x!=last){ if(yes||v.size()>root)Query(i),yes=1; else v.insert(i),last=x; } else{ for(auto j:v){ if(Query(j)==x){ Query(i); Answer(i,j); done[i]=1,done[j]=1; cnt+=2; v.erase(v.find(j)); last--; break; } else Query(j); } } } } } /* when add new element and no of type doesnt change we can try taking one out in the current set if no of type stay the same then they are a pair this will cost n^2 do sqrt? */

Compilation message (stderr)

minerals.cpp:33:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
   33 | #pragma GCC optimize ("03,unroll-lopps")
      |                                        ^
minerals.cpp:34:17: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   34 | void Solve(int n){
      |                 ^
minerals.cpp: In function 'void Solve(int)':
minerals.cpp:45:25: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   45 |         if(yes||v.size()>root)Query(i),yes=1;
      |                 ~~~~~~~~^~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...