이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long lo;
#define fi first
#define se second
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
const lo inf = 1000000000;
const lo li = 500005;
const lo mod = 1000000007;
int n,m,a[li],k,flag,t,l,r,cev[li];
string s;
map<pair<int,int>,int> mpp,mpp1;
vector<pair<int,int>> v[li];
int main(void){
scanf("%d %d %d",&l,&r,&m);
for(int i=1;i<=m;i++){
int x,y;
scanf("%d %d",&x,&y);
v[x].pb({y,i});
//~ v[y].pb({x,i});
}
int mx=0;
for(int i=1;i<=l;i++){
for(auto go:v[i]){
for(int j=1;j<=100000000;j++){
if(mpp.find({go.fi,j})==mpp.end() && mpp1.find({i,j})==mpp1.end()){
mpp[{go.fi,j}]=1;
mpp1[{i,j}]=1;
cev[go.se]=j;
mx=max(mx,j);
break;
}
}
}
}
printf("%d\n",mx);
for(int i=1;i<=m;i++)printf("%d\n",cev[i]);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
teoreticar.cpp: In function 'int main()':
teoreticar.cpp:26:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
26 | scanf("%d %d %d",&l,&r,&m);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
teoreticar.cpp:29:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
29 | scanf("%d %d",&x,&y);
| ~~~~~^~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |