Submission #6519367
Source Code Expand
#include <iostream> #include <iomanip> #include <vector> #include <string> #include <algorithm> #include <cmath> #include <stack> #include <queue> #include <functional> #include <limits.h> #include <set> #include <map> #include <tuple> using namespace std; #define ll long long #define ull unsigned long long #define rep(i,N) for (ll i=0;i<N;i++) #define loop(i,N,M) for(ll i=N;i<M;i++) #define MAX(v) *max_element(v.begin(),v.end()) #define MIN(v) *min_element(v.begin(),v.end()) #define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>()) #define SORTS2L(type,v) sort(v.begin(),v.end()) #define SORTMF(v,func) sort(v.begin(),v.end(),func) ll debugFlag = false; template<typename T> void debug(T& obj) { debug(obj, true); } template<typename T> void debug(T& obj, bool lnFlag) { if (!debugFlag) return; cout << obj; if (lnFlag) cout << endl; } template<typename T> void debug(vector<T>& val) { debug(val, true); } template<typename T> void debug(vector<T>& val, bool lnFlag) { if (!debugFlag) return; cout << "["; rep(i, val.size()) { if (i != 0) cout << ","; debug(val[i], false); } cout << "]"; if (lnFlag) cout << endl; } template<typename T, typename U> void debug(pair<T, U>& val) { debug(val, true); } template<typename T, typename U> void debug(pair<T, U>& val, bool lnFlag) { if (!debugFlag) return; cout << "("; debug(val.first, false); cout << ","; debug(val.second, false); cout << ")"; if (lnFlag) cout << endl; } ll N; void solve() { cin >> N; ll bin = 0; rep(i, N) { ll input; cin >> input; bin |= input; debug(bin); } ll ans = 0; while (1) { if (bin & 1 == 1) break; ans++; bin >>= 1; } cout << ans; } int main(int argc, char* argv[]) { if (argc == 2 && string(argv[1]) == "debug") debugFlag = true; solve(); cout << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Shift only |
User | huma17 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1921 Byte |
Status | CE |
Compile Error
./Main.cpp: In instantiation of ‘void debug(T&) [with T = long long int]’: ./Main.cpp:83:12: required from here ./Main.cpp:30:7: error: no matching function for call to ‘debug(long long int&, bool)’ debug(obj, true); ^ ./Main.cpp:29:6: note: candidate: template<class T> void debug(T&) void debug(T& obj) { ^ ./Main.cpp:29:6: note: template argument deduction/substitution failed: ./Main.cpp:30:7: note: candidate expects 1 argument, 2 provided debug(obj, true); ^