제출 #1249589

#제출 시각아이디문제언어결과실행 시간메모리
1249589ammakaDetecting Molecules (IOI16_molecules)C++20
0 / 100
14 ms3000 KiB
//#include <GOD> //kole shahr khakestary , bala sar man ranginkamon #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; #define pb push_back #define len length #define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0); #define freo freopen("guard.out","w",stdout) #define frei freopen("guard.in","r",stdin) const ll inf=1e18+10; const ll mod=1e9+7; const ll maxn=(2e5)+10,maxm=1e5+10,sq=310+10,maxa=(1<<maxn),mlg=32; int ss[maxn],ps[maxn]; vector<int> find_subset(int l, int u, vector<int> w){ // frei; // freo; // FAST_IO; // ll l=(long long)l; int ind; int mn = 2147483647; int n=w.size(); vector <int> ans; ans.clear(); // cout<<mn<<endl; if(l>u){ return ans; } for(int i=1;i<=n;i++){ ps[i]=ps[i-1]+w[i-1]; if(w[i-1]<mn){ mn=w[i-1]; ind=i-1; } } for(int i=n;i>=1;i--){ ss[i]=ss[i+1]+w[i-1]; } // cout<<mn<<' '<<u<<' '<<l<<' '<<ps[n]<<endl; if(mn<=u&&ps[n]>=l){ if(mn>=l){ ans.pb(ind); return ans; }else if(ps[n]<=u){ for(int i=0;i<n;i++){ ans.pb(i); } return ans; }else{ for(int k=1;k<=n;k++){ if(ps[k]>=l&&ps[k]<=u){ for(int i=0;i<k;i++){ ans.pb(i); } return ans; }else if(ss[n-k+1]>=l&&ss[n-k+1]<=u){ for(int i=n-1;i>=n-k;i--){ ans.pb(i); } return ans; }else if(ps[k]<l&&ss[n-k+1]>u){ for(int i=1;i<=n-k+1;i++){ if(ps[i+k-1]-ps[i-1]>=l){ for(int j=i;j<=i+k-1;j++){ ans.pb(j-1); } return ans; } } } } } }else{ return ans; } }

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

molecules.cpp:15:53: warning: left shift count >= width of type [-Wshift-count-overflow]
   15 | const ll maxn=(2e5)+10,maxm=1e5+10,sq=310+10,maxa=(1<<maxn),mlg=32;
      |                                                    ~^~~~~~
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:82:1: warning: control reaches end of non-void function [-Wreturn-type]
   82 | }
      | ^
molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...