제출 #572191

#제출 시각아이디문제언어결과실행 시간메모리
572191RandomLB질문 (CEOI14_question_grader)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef pair<int, int> pi; typedef pair<ll, ll> pll; template<class T> using indexed_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; #define fbo find_by_order //(k-indexed val with 0-indexing) #define ook order_of_key //(num of vals in set that are strictly less) #define ms(x, a) memset(x, a, sizeof(x)) #define siz(x) (int)x.size() #define len(x) (int)x.length() #define pb push_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define F first #define S second #define deb(...) logger(#__VA_ARGS__, __VA_ARGS__) template<typename ...Args> void logger(string vals, Args&&... values){ cout << vals << " = "; string delim = ""; (...,(cout << delim << values, delim = ", ")); cout << endl; } const int INF = 0x3f3f3f3f; const ll LLINF = 0x3f3f3f3f3f3f3f3f; const int MOD = 1e9+7; //=========================================== int encode (int n, int a, int b){ for (int i = 0; i < 10; i++){ if ((a&(1<<i)) != (b&(1<<i))){ return ((a&(1<<i))? 11 : 1)+i; } } } int decode (int n, int q, int h){ bool on = (h > 10); if (h > 10) h -= 11; else h--; return ((q&(1<<h)) > 0 == on? 1 : 0); } int main(){ cin.tie(0)->sync_with_stdio(0); }
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef pair<int, int> pi; typedef pair<ll, ll> pll; template<class T> using indexed_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; #define fbo find_by_order //(k-indexed val with 0-indexing) #define ook order_of_key //(num of vals in set that are strictly less) #define ms(x, a) memset(x, a, sizeof(x)) #define siz(x) (int)x.size() #define len(x) (int)x.length() #define pb push_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define F first #define S second #define deb(...) logger(#__VA_ARGS__, __VA_ARGS__) template<typename ...Args> void logger(string vals, Args&&... values){ cout << vals << " = "; string delim = ""; (...,(cout << delim << values, delim = ", ")); cout << endl; } const int INF = 0x3f3f3f3f; const ll LLINF = 0x3f3f3f3f3f3f3f3f; const int MOD = 1e9+7; //=========================================== int encode (int n, int a, int b){ for (int i = 0; i < 10; i++){ if ((a&(1<<i)) != (b&(1<<i))){ return ((a&(1<<i))? 11 : 1)+i; } } } int decode (int n, int q, int h){ bool on = (h > 10); if (h > 10) h -= 11; else h--; return ((q&(1<<h)) > 0 == on? 1 : 0); } int main(){ cin.tie(0)->sync_with_stdio(0); }

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

encoder.cpp: In function 'int decode(int, int, int)':
encoder.cpp:46:24: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
   46 |     return ((q&(1<<h)) > 0 == on? 1 : 0);
      |             ~~~~~~~~~~~^~~
encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^
/usr/bin/ld: /tmp/cc4DZpR0.o: in function `main':
grader_encode.c:(.text.startup+0x0): multiple definition of `main'; /tmp/cc1HbCsZ.o:encoder.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:46:24: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
   46 |     return ((q&(1<<h)) > 0 == on? 1 : 0);
      |             ~~~~~~~~~~~^~~
decoder.cpp: In function 'int encode(int, int, int)':
decoder.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^
/usr/bin/ld: /tmp/cc3cGt6L.o: in function `main':
grader_decode.c:(.text.startup+0x0): multiple definition of `main'; /tmp/ccwa8jSN.o:decoder.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status