Submission #656108

#TimeUsernameProblemLanguageResultExecution timeMemory
656108nolimiyaPort Facility (JOI17_port_facility)C++14
0 / 100
281 ms35540 KiB
#include <bits/stdc++.h> #include <math.h> //in the name of god,aka allah //**gray sety orz** #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC optimize("-fgcse") #pragma GCC optimize("-fgcse-lm") #pragma GCC optimize("-fipa-sra") #pragma GCC optimize("-ftree-pre") #pragma GCC optimize("-ftree-vrp") #pragma GCC optimize("-fpeephole2") #pragma GCC optimize("-fsched-spec") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("-falign-jumps") #pragma GCC optimize("-falign-loops") #pragma GCC optimize("-falign-labels") #pragma GCC optimize("-fdevirtualize") #pragma GCC optimize("-fcaller-saves") #pragma GCC optimize("-fcrossjumping") #pragma GCC optimize("-fthread-jumps") #pragma GCC optimize("-funroll-loops") #pragma GCC optimize("no-stack-protector") #pragma GCC optimize("-freorder-functions") #pragma GCC optimize("-findirect-inlining") #pragma GCC optimize("-fhoist-adjacent-loads") #pragma GCC optimize("-frerun-cse-after-loop") #pragma GCC optimize("-ftree-switch-conversion") #pragma GCC optimize("-foptimize-sibling-calls") #pragma GCC optimize("-fexpensive-optimizations") #pragma GCC optimize("-fdelete-null-pointer-checks") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") #pragma GCC optimize("unroll-loops") using namespace std; #define pi pair<long long , long long> #define pii pair<long long , pair<long long , long long>> const int maxm = 5e5; const long long mod = 1e9 + 7 ; typedef long long ll; ll l,r,mid; ll n,m; ll dis[maxm] , sum[maxm]; bool isval(int mid){ //cout << mid <<" " << mid*mid-mid <<endl; if (((mid-1)*mid)/2 < m) return 0; return 1; } ll darage[maxm] , ss , mm; queue<int> q; vector<pi> g[maxm] , z[maxm]; ll sath[maxm]; bool vis[maxm] , gos[maxm]; ll pedaret[maxm]; ll get_par(ll v){ if (pedaret[v]==v) return v; return pedaret[v] = get_par(pedaret[v]); } void merge(ll r , ll q){ if (get_par(r)!=get_par(q))l+=max(darage[r],darage[q])*1ll*sath[r]*1ll*sath[q]; r = get_par(r) , q = get_par(q); if (r!=q){ if (sath[r]<sath[q]) swap(r,q); pedaret[q] = r; sath[r] += sath[q]; } return ; } ll pars1[maxm] , pars2[maxm]; vector<ll> se[maxm]; set<pi> st; ll rp[maxm]; pi w[maxm]; ll dp[maxm]; //ll rw[maxm][maxm]; map<ll,ll> mp; int main(){ ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); cin >>n; for (int i=0; i<n; i++) cin>>w[i].first>>w[i].second; sort(w,w+n); for (int mask=0; mask<(1<<n); mask++){ vector<pi> A,B; for (int i=0; i<n; i++){ if (mask&(1<<i)) A.push_back(w[i]); else B.push_back(w[i]); } l = 0; for (int i=0; i<A.size(); i++){ for (int j=i+1; j<A.size(); j++){ //cout<<A[i].first<<" "<<A[i].second<<" "<<A[j].first<<" "<<A[j].second<<endl; if (A[i].first<=A[j].first && A[i].second<=A[j].second && A[j].first<=A[i].second) l = 1; } } for (int i=0; i<B.size(); i++){ for (int j=i+1; j<B.size(); j++){ //cout<<B[i].first<<" "<<B[i].second<<" "<<B[j].first<<" "<<B[j].second<<endl; if (B[i].first<=B[j].first && B[i].second<=B[j].second && B[j].first<=B[i].second) l = 1; } } if (!l) cout<<mask<<endl; mid+=(1-l); } cout<<mid<<'\n'; }

Compilation message (stderr)

port_facility.cpp:5: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
    5 | #pragma comment(linker, "/stack:200000000")
      | 
port_facility.cpp: In function 'int main()':
port_facility.cpp:88:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   88 |         for (int i=0; i<A.size(); i++){
      |                       ~^~~~~~~~~
port_facility.cpp:89:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   89 |             for (int j=i+1; j<A.size(); j++){
      |                             ~^~~~~~~~~
port_facility.cpp:94:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   94 |         for (int i=0; i<B.size(); i++){
      |                       ~^~~~~~~~~
port_facility.cpp:95:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   95 |             for (int j=i+1; j<B.size(); j++){
      |                             ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...