제출 #1229819

#제출 시각아이디문제언어결과실행 시간메모리
1229819nhnguyen14Sob (COCI19_sob)C++20
0 / 110
0 ms328 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

const int MAXLOG=20;
const int N=(int)1e6;
	int n,m;

namespace subtask1{
	bool check(){
		return n+m<=1000;
	}
	
	int f[N+2]={};
	
	void main_code(){
		int cnt=0;
		for(int i=0;i<n;++i){
			for(int j=m;j<m+n;++j) if ((j&i)==i) ++f[j];
		}
		for(int j=m;j<n+m;++j) assert(f[j]>0);
		for(int i=n-1;i>=0;--i){
			int mxx=n+1,v=-1;
			for(int j=m;j<=n+m-1;++j){
				if (f[j] && (j&i)==i && mxx>f[j]){
					mxx=f[j];
					v=j;
				}
			}
			assert(v!=-1);
			f[v]=0;
			cout<<i<<' '<<v<<'\n';
			for(int j=m;j<=m+n-1;++j) {
				if (f[j]>0 && (j&i)==i) --f[j];
			}
		}
		return;
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0) ; cout.tie(0);
	#define task "main"
	if (fopen(task".inp","r")){
		freopen(task".inp","r",stdin);
//		freopen(task".out","w",stdout);
	}
	cin>>n>>m;
	if (subtask1::check()) return subtask1::main_code(),0;
	assert(false);
	return 0;
}

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

sob.cpp: In function 'int main()':
sob.cpp:46:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   46 |                 freopen(task".inp","r",stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...