# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
596044 |
2022-07-14T09:30:21 Z |
AGE |
Sob (COCI19_sob) |
C++14 |
|
375 ms |
57128 KB |
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define int long long
using namespace std;
const int N=2e6+10,M=2e3,mod=10;
int vis[N],cnt=1,mt[N];
vector<int>adj[N];
bool trykuhn(int node){
if(vis[node]==cnt)
return 0;
vis[node]=cnt;
for(auto x:adj[node]){
if(mt[x]==-1){
mt[x]=node;
return 1;
}
}
for(auto x:adj[node]){
if(trykuhn(mt[x])){
mt[x]=node;return 1;
}
}
return 0;
}
main()
{
int n,m;
cin>>n>>m;
if(n+m<=1000){
for(int i=0;i<n;i++){
for(int j=m;j<n+m;j++){
if((i&j)==i)
adj[i].pb(j),adj[j].pb(i);
}
}
for(int i=0;i<n+m;i++)
mt[i]=-1;
for(int i=0;i<n;i++){
trykuhn(i),cnt++;
}
for(int i=0;i<n;i++)
cout<<mt[i+m]<<" "<<i+m<<endl;
}
else{
vector<pair<int,int>>v;
for(int i=m;i<n+m;i++){
bitset<32>bt;
int num=0;
bt=i;
for(int j=0;j<31;j++){
if(bt[j]==1){
num+=(1<<j);
if(vis[num]==0){
vis[num]=1;
break;
}
}
}
if(num==n){
num=0;
}
v.pb({num,i});
}
sort(v.begin(),v.end());
for(int i=0;i<v.size();i++)
cout<<v[i].F<<" "<<v[i].S<<endl;
}
return 0;
}
Compilation message
sob.cpp:37:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
37 | main()
| ^~~~
sob.cpp: In function 'int main()':
sob.cpp:96:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
96 | for(int i=0;i<v.size();i++)
| ~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
47196 KB |
Integer parameter [name=x] equals to 512, violates the range [0, 127] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
47352 KB |
Output is correct |
2 |
Correct |
25 ms |
47352 KB |
Output is correct |
3 |
Correct |
26 ms |
47344 KB |
Output is correct |
4 |
Correct |
27 ms |
47188 KB |
Output is correct |
5 |
Correct |
25 ms |
47232 KB |
Output is correct |
6 |
Correct |
375 ms |
57128 KB |
Output is correct |
7 |
Correct |
200 ms |
51952 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
47188 KB |
Output is correct |
2 |
Correct |
24 ms |
47316 KB |
Output is correct |
3 |
Correct |
24 ms |
47308 KB |
Output is correct |
4 |
Correct |
28 ms |
47416 KB |
Output is correct |
5 |
Correct |
23 ms |
47232 KB |
Output is correct |
6 |
Correct |
28 ms |
47572 KB |
Output is correct |
7 |
Correct |
25 ms |
47624 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
47196 KB |
Integer parameter [name=x] equals to 512, violates the range [0, 127] |
2 |
Halted |
0 ms |
0 KB |
- |