QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#769222#8936. Team ArrangementRegister#Compile Error//C++14694b2024-11-21 16:38:162024-11-21 16:38:22

Details

answer.code: In function ‘int main()’:
answer.code:2:505: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
    2 | using namespace std;int n;vector<pair<int,int>>students;vector<int>w;long long best=LLONG_MIN;void dfs(long long state,int size,long long score){if(not size)return;if(state==(1ll<<n)-1){best=max(best,score);return;}dfs(state,size-1,score);int i=0;for(int j=0;i<size and j<n;j++){if(state&(1ll<<j))continue;if(students[j].first<=size and size<=students[j].second){state|=1ll<<j;i++;}}if(i==size)dfs(state,size,score+w[size-1]);}int main(){cin.tie(0)->sync_with_stdio(0);cin>>n;students.resize(n);for(auto&[l,r]:students)cin>>l>>r;ranges::sort(students,greater());w.resize(n);for(auto&x:w)cin>>x;dfs(0,60,0);if(best==LLONG_MIN)cout<<"impossible\n";else cout<<best<<'\n';}
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ^
answer.code:2:530: error: ‘ranges’ has not been declared
    2 | using namespace std;int n;vector<pair<int,int>>students;vector<int>w;long long best=LLONG_MIN;void dfs(long long state,int size,long long score){if(not size)return;if(state==(1ll<<n)-1){best=max(best,score);return;}dfs(state,size-1,score);int i=0;for(int j=0;i<size and j<n;j++){if(state&(1ll<<j))continue;if(students[j].first<=size and size<=students[j].second){state|=1ll<<j;i++;}}if(i==size)dfs(state,size,score+w[size-1]);}int main(){cin.tie(0)->sync_with_stdio(0);cin>>n;students.resize(n);for(auto&[l,r]:students)cin>>l>>r;ranges::sort(students,greater());w.resize(n);for(auto&x:w)cin>>x;dfs(0,60,0);if(best==LLONG_MIN)cout<<"impossible\n";else cout<<best<<'\n';}
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ^~~~~~
answer.code:2:559: error: missing template arguments before ‘(’ token
    2 | using namespace std;int n;vector<pair<int,int>>students;vector<int>w;long long best=LLONG_MIN;void dfs(long long state,int size,long long score){if(not size)return;if(state==(1ll<<n)-1){best=max(best,score);return;}dfs(state,size-1,score);int i=0;for(int j=0;i<size and j<n;j++){if(state&(1ll<<j))continue;if(students[j].first<=size and size<=students[j].second){state|=1ll<<j;i++;}}if(i==size)dfs(state,size,score+w[size-1]);}int main(){cin.tie(0)->sync_with_stdio(0);cin>>n;students.resize(n);for(auto&[l,r]:students)cin>>l>>r;ranges::sort(students,greater());w.resize(n);for(auto&x:w)cin>>x;dfs(0,60,0);if(best==LLONG_MIN)cout<<"impossible\n";else cout<<best<<'\n';}
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ^