제출 #85391

#제출 시각아이디문제언어결과실행 시간메모리
85391DiegoGarciaTeoretičar (COCI18_teoreticar)C++11
0 / 130
12106 ms45000 KiB
#include <stdio.h> #include <vector> #define ft first #include <string.h> #include <algorithm> #include <stdlib.h> #define sd second #define ll long long using namespace std; const ll MAXM = 5e5 + 3; const ll MAXN = 1e5 + 3; pair <ll,ll> edg[MAXM]; ll l,r,m,minColor,buck1[MAXN],buck2[MAXN],sol[MAXM]; bool color[MAXM]; void getPerm( ll niv ) { if( niv == m ){ /* printf("para color = %lld tenemos esto: ", minColor ); for( ll i=0; i<m; i++ ) printf("%lld ",sol[i]); printf("\n");*/ for( ll i=1; i<=l; i++ ){ memset(color, 0, sizeof color ); for( ll j=0; j<m; j++ ){ if( edg[j].ft == i ){ if( color[sol[j]] ) return; color[sol[j]] = true; } } } for( ll i=1; i<=r; i++ ){ memset(color, 0, sizeof color ); for( ll j=0; j<m; j++ ){ if( edg[j].sd == i ){ if( color[sol[j]] ) return; color[sol[j]] = true; } } } printf("%lld\n", minColor); for( ll i=0; i<m; i++ ) printf("%lld\n",sol[i]); exit(0); return; } for( ll i=1; i<=minColor; i++ ) { sol[niv] = i; getPerm(niv+1); } } int main() { scanf("%lld %lld %lld",&l,&r,&m); for( ll i=0; i<m; i++ ) { scanf( "%lld %lld", &edg[i].ft, &edg[i].sd ); buck1[edg[i].ft]++; buck2[edg[i].sd]++; minColor=max(minColor, max(buck1[edg[i].ft], buck2[edg[i].sd]) ); } while( true ) { getPerm( 0 ); //factorial, llenta todas las coloraciones posibles, empezando desde la minima requerida que es el maximo grado de un vertice minColor++; printf("%lld\n",minColor); } return 0; }

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

teoreticar.cpp: In function 'int main()':
teoreticar.cpp:52:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld %lld",&l,&r,&m);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
teoreticar.cpp:55:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf( "%lld %lld", &edg[i].ft, &edg[i].sd );
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...
#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...