제출 #234929

#제출 시각아이디문제언어결과실행 시간메모리
234929muhammad_hokimiyon미술 수업 (IOI13_artclass)C++14
컴파일 에러
0 ms0 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { int a = 0 , b = 0 , c = 0; int t = 0; for( int i = 0; i < H; i++ ){ for( int j = 0; j < W; j++ ){ if( R[i][j] > max(G[i][j] , B[i][j]) )a += 1; else if( G[i][j] > max(R[i][j] , B[i][j]) )b += 1; else if( B[i][j] > max(R[i][j] , G[i][j]) )c += 1; else if( abs(R[i][j] - G[i][j]) <= 10 && abs(R[i][j] - B[i][j]) <= 10 )t += 1; } } if( a >= max(b , c) )return 2; if( t * 1.0 >= 1.0 * H * W * 30 / 100 )return 1; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); return (abs(rng()) % 4) + 1; }

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

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:21:22: error: call of overloaded 'abs(std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>::result_type)' is ambiguous
     return (abs(rng()) % 4) + 1;
                      ^
In file included from /usr/include/c++/7/bits/std_abs.h:38:0,
                 from /usr/include/c++/7/cmath:47,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from artclass.cpp:2:
/usr/include/stdlib.h:774:12: note: candidate: int abs(int)
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^~~
In file included from /usr/include/c++/7/cmath:47:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from artclass.cpp:2:
/usr/include/c++/7/bits/std_abs.h:56:3: note: candidate: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^~~
/usr/include/c++/7/bits/std_abs.h:61:3: note: candidate: long long int std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^~~
/usr/include/c++/7/bits/std_abs.h:70:3: note: candidate: constexpr double std::abs(double)
   abs(double __x)
   ^~~
/usr/include/c++/7/bits/std_abs.h:74:3: note: candidate: constexpr float std::abs(float)
   abs(float __x)
   ^~~
/usr/include/c++/7/bits/std_abs.h:78:3: note: candidate: constexpr long double std::abs(long double)
   abs(long double __x)
   ^~~