Submission #1066731

#TimeUsernameProblemLanguageResultExecution timeMemory
1066731kunzaZa183Alternating Current (BOI18_alternating)C++17
13 / 100
3026 ms1880 KiB
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0)->sync_with_stdio(0); int n,m; cin>>n>>m; vector<pair<int,int>> vpii(m); for(auto &a:vpii) { cin>>a.first>>a.second; a.first--,a.second--; } auto gogo = [](int a,int b, vector<int> &vi){ if(a<=b) for(int i = a; i <= b; i++) vi[i] = 1; else { for(int i = a; i < vi.size();i++) vi[i] = 1; for(int i = 0; i <= b; i++) vi[i] = 1; } }; for(int i = 0; i < (1<<m);i++) { vector<int> firstone(n, 0),secondone(n,0); for(int j = 0; j < m; j++) { if(i & (1<<j)){ gogo(vpii[j].first,vpii[j].second,firstone); } else{ // if(i==5) // cout<<vpii[j].first<<' '<<vpii[j].second<<"\n"; gogo(vpii[j].first,vpii[j].second,secondone); } } if(count(firstone.begin(),firstone.end(),0) == 0 && count(secondone.begin(),secondone.end(),0) == 0) { // for(auto a:firstone) // cout<<a<<' '; // cout<<"\n"; // for(auto a:secondone) // cout<<a<<' '; // cout<<"\n"; for(int j = 0; j < m; j++) { if(i & (1<<j)){ cout<<1; } else cout<<0; } cout<<"\n"; return 0; } } cout<<"impossible\n"; }

Compilation message (stderr)

alternating.cpp: In lambda function:
alternating.cpp:15:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |    for(int i = a; i < vi.size();i++)
      |                   ~~^~~~~~~~~~~
#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...