submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s866520878
p03699
C++
#include <iostream> #include <vector> #include <numeric> using namespace std; int main() { int N; cin >> N; vector<int> s(N); for (int i = 0; i < N; ++i) { cin >> s[i]; } sort(s.begin(), s.end()); int ans = accumulate(s.begin(), s.end(), 0); for (int j = 0; j < N; ++j) { if (ans % 10 != 0) { cout << ans; return 0; } ans -= s[j]; } cout << 0; }
a.cc: In function 'int main()': a.cc:14:5: error: 'sort' was not declared in this scope; did you mean 'short'? 14 | sort(s.begin(), s.end()); | ^~~~ | short
s482040441
p03699
C++
#include <iostream> #include <cstdio> #include <cstring> using namespace std; int p[110],n,sum; int main(){ scanf("%d",&n); for(int i = 0 ; i < n ; i++) scanf("%d",p+i),sum+=p[i],p[i] = p[i]%10==0?0:p[i]; sort(p,p+n); if( sum % 10 == 0 ){ for(int j = 0 ; j < n ; j++){ sum-=p[j]; if(sum%10) break; } }else sum = 0; printf("%d\n",sum); return 0; }
a.cc: In function 'int main()': a.cc:11:2: error: 'sort' was not declared in this scope; did you mean 'short'? 11 | sort(p,p+n); | ^~~~ | short
s542999640
p03699
C++
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication32 { class Program { static void Main(string[] args) { int a = int.Parse(Console.ReadLine()); int[] b = new int[a]; int ans; for(int c =0;c<a;c++) b[c]=int.Parse(Console.ReadLine()); for(int c =0;c<a;c++) ans+=b[c]; Array.Sort(b); if(ans%10!=0) Console.WriteLine(ans); else for(int c =0;c<a;c++) { ans=ans-b[c] if(ans%10!=0) break; } Console.WriteLine(ans);
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Collections.Generic; | ^~~~~~ a.cc:3:7: error: expected nested-name-specifier before 'System' 3 | using System.Linq; | ^~~~~~ a.cc:4:7: error: expected nested-name-specifier before 'System' 4 | using System.Text; | ^~~~~~ a.cc:10:26: error: 'string' has not been declared 10 | static void Main(string[] args) | ^~~~~~ a.cc:10:35: error: expected ',' or '...' before 'args' 10 | static void Main(string[] args) | ^~~~ a.cc:28:48: error: expected '}' at end of input 28 | Console.WriteLine(ans); | ^ a.cc:9:5: note: to match this '{' 9 | { | ^ a.cc: In static member function 'static void ConsoleApplication32::Program::Main(int*)': a.cc:12:33: error: expected primary-expression before 'int' 12 | int a = int.Parse(Console.ReadLine()); | ^~~ a.cc:13:28: error: structured binding declaration cannot have type 'int' 13 | int[] b = new int[a]; | ^~ a.cc:13:28: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:13:28: error: empty structured binding declaration a.cc:13:31: error: expected initializer before 'b' 13 | int[] b = new int[a]; | ^ a.cc:16:25: error: 'b' was not declared in this scope 16 | b[c]=int.Parse(Console.ReadLine()); | ^ a.cc:16:30: error: expected primary-expression before 'int' 16 | b[c]=int.Parse(Console.ReadLine()); | ^~~ a.cc:18:30: error: 'b' was not declared in this scope 18 | ans+=b[c]; | ^ a.cc:19:25: error: 'Array' was not declared in this scope 19 | Array.Sort(b); | ^~~~~ a.cc:19:36: error: 'b' was not declared in this scope 19 | Array.Sort(b); | ^ a.cc:21:25: error: 'Console' was not declared in this scope 21 | Console.WriteLine(ans); | ^~~~~~~ a.cc:28:25: error: 'Console' was not declared in this scope 28 | Console.WriteLine(ans); | ^~~~~~~ a.cc:28:48: error: expected '}' at end of input 28 | Console.WriteLine(ans); | ^ a.cc:11:9: note: to match this '{' 11 | { | ^ a.cc: At global scope: a.cc:28:48: error: expected unqualified-id at end of input 28 | Console.WriteLine(ans); | ^ a.cc:28:48: error: expected '}' at end of input a.cc:7:1: note: to match this '{' 7 | { | ^
s020436153
p03699
C++
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <map> using namespace std; int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); int n; cin >> n; vector<int> s(n); for(int i = 0; i < n; i++){ cin >> s[i]; } sort(s.begin(),s.end()); long sum = 0; for(int i = n - 1; i >= 0; i--){ sum += s[i]; } for(int i = 0; i < n; i++){ if(sum % 10 != 0){ cout << sum << endl; return 0; } sum -= s[i]; } for(int n - 1; i >= 0; i--){ if(s[i] % 10 != 0){ cout << s[i] << endl; return 0; } } cout << 0 << endl; }
a.cc: In function 'int main()': a.cc:30:12: error: expected ';' before '-' token 30 | for(int n - 1; i >= 0; i--){ | ^~ | ; a.cc:30:18: error: 'i' was not declared in this scope 30 | for(int n - 1; i >= 0; i--){ | ^ a.cc:30:24: error: expected ')' before ';' token 30 | for(int n - 1; i >= 0; i--){ | ~ ^ | ) a.cc:30:26: error: 'i' was not declared in this scope 30 | for(int n - 1; i >= 0; i--){ | ^
s229716775
p03699
C++
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <map> using namespace std; int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); int n; cin >> n; vector<int> s(n); for(int i = 0; i < n; i++){ cin >> s[i]; } sort(s.begin(),s.end()); long sum = 0; for(int i = n - 1; i >= 0; i--){ sum += s[i]; } for(int i = 0; i < n; i++){ if(sum % 10 != 0){ cout << sum << endl; return 0; } sum -= s[i]; } for(int n - 1; i >= 0; i++){ if(s[i] % 10 != 0){ cout << s[i] << endl; return 0; } } cout << 0 << endl; }
a.cc: In function 'int main()': a.cc:30:12: error: expected ';' before '-' token 30 | for(int n - 1; i >= 0; i++){ | ^~ | ; a.cc:30:18: error: 'i' was not declared in this scope 30 | for(int n - 1; i >= 0; i++){ | ^ a.cc:30:24: error: expected ')' before ';' token 30 | for(int n - 1; i >= 0; i++){ | ~ ^ | ) a.cc:30:26: error: 'i' was not declared in this scope 30 | for(int n - 1; i >= 0; i++){ | ^
s550112789
p03700
C++
#include<bits/stdc++.h> using namespace std; #pragma region atcoder #include <atcoder/dsu> using namespace atcoder; #pragma endregion #pragma region macros using ll = long long; using vi = vector<int>; using vs = vector<string>; using vl = vector<ll>; using vb = vector<bool>; using vvi = vector<vector<int>>; using vvl = vector<vector<ll>>; using vvc = vector<vector<char>>; #define rep(i, n) for(int i = 0; i < n; i++) #define rrep(i, n) for(int i = n - 1; i >= 0; i--) #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) #pragma endregion #pragma region debug for var, v, vv #define debug(var) do{std::cout << #var << " : ";view(var);}while(0) template<typename T> void view(T e){std::cout << e << std::endl;} template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;} template<typename T> void view(const std::vector<std::vector<T> >& vv){cout << endl;int cnt = 0;for(const auto& v : vv){cout << cnt << "th : "; view(v); cnt++;} cout << endl;} #pragma endregion const ll mod = 1000000007; const int inf = 1001001001; const ll INF = 1001001001001001001; const int MAX = 2000005; template<class T>bool chmax(T &a, const T b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T b) { if (b<a) { a=b; return 1; } return 0; } ll modpow(ll a, ll p){ll ret = 1; while(p){if(p & 1){ret = ret * a % mod;} a = a * a % mod; p >>= 1;} return ret;} int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; /*-----------------------------------------------------------------------------------------------------*/ int main(){ int n; cin >> n; ll a, b; cin >> a >> b; a -= b; vl h(n); rep(i,n) cin >> h[i]; ll ok = (ll)1e9 + 1, ng = 0; while(ok - ng > 1){ ll mid = (ok + ng) / 2; auto f = [&](){ ll num = 0; vl res = h; for(int i = 0; i < n; i++) res[i] -= b * mid; for(int i = 0; i < n; i++){ if(res[i] > 0) num += (res[i] + a - 1) / a; } if(num <= mid) return true; else return false; }; if(f()) ok = mid; else ng = mid; } cout << ok << endl; }
a.cc:4:10: fatal error: atcoder/dsu: No such file or directory 4 | #include <atcoder/dsu> | ^~~~~~~~~~~~~ compilation terminated.
s779934305
p03700
C++
#include <iostream> #include <algorithm> #include <iomanip> #include <string> #include <vector> #include <math.h> #include <queue> #include <deque> #include <stack> #include <map> #define PI 3.14159265359 typedef long long ll; const int MOD = 1e9+7; const ll LLINF = 1e18; using namespace std; ll n, a, b; bool is_ok(vector<ll> &h, ll num){ ll coun = 0; for (int i = 0; i < n; i++){ coun += max(0, (h[i] - b*num + a - 1)/a); } if (coun <= num) return true; return false; } int nibutan(vector<ll> &h, ll ok, ll ng){ if (ok - ng == 1) return ok; ll mid = (ok+ng)/2; if (is_ok(h, mid)) return nibutan(h, mid, ng); return nibutan(h, ok, mid); } int main(){ cin >> n >> a >> b; vector<ll> h(n); ll hmax = 0; for (int i = 0; i < n; i++){ cin >> h[i]; hmax = max(hmax, h[i]); } a -= b; cout << nibutan(h, hmax/b+1, 0) << endl; return 0; }
a.cc: In function 'bool is_ok(std::vector<long long int>&, ll)': a.cc:22:28: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 22 | coun += max(0, (h[i] - b*num + a - 1)/a); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:22:28: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 22 | coun += max(0, (h[i] - b*num + a - 1)/a); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:22:28: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 22 | coun += max(0, (h[i] - b*num + a - 1)/a); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s477548815
p03700
C++
#include <bits/stdc++.h> using namespace std; #define int long long using vec_int = vector<int>; using P = pair<int,int>; using T = tuple<int,int,int>; using ll = long long; #define rep(i, n) for(int i = 0; i < (int)(n); i++) int charToInt(char c){ char zero_num = '0'; return (int)c - (int)zero_num; } signed main(){ int N, A, B; cin>>N>>A>>B; vec_int h(N); rep(i,N)cin>>h.at(i); //一撃で終わる場合 int kaisuu0=0; for(int i=0;i<N;i++){ if(h.at(i)>B){ if(h.at(i)>A){ break; } kaisuu++; } } if(kaisuu0<2){ cout<<1<<endl; return 0; } int upper_num = 2*pow(10,9); int lower_num = 1; while(lower_num+1<upper_num){ int med = (lower_num+upper_num)/2; int kaisuu = 0; for(int i=0;i<N;i++){ if(h.at(i)-B*med>0){ kaisuu += (h.at(i)-B*med)/(A-B); if((h.at(i)-B*med)%(A-B)!=0){ kaisuu += 1; } } } if(kaisuu<=med){ upper_num = med; }else{ lower_num = med; } } cout<<upper_num<<endl; return 0; }
a.cc: In function 'int main()': a.cc:28:9: error: 'kaisuu' was not declared in this scope; did you mean 'kaisuu0'? 28 | kaisuu++; | ^~~~~~ | kaisuu0
s517906645
p03700
C++
#include <iostream> #include <iomanip> #include <vector> #include <stack> #include <queue> #include <set> #include <map> #include <algorithm> #include <cstdio> #include <utility> #include <string> #include <cmath> #include <cstdlib> #include <cstring> #include <deque> #include <numeric> using namespace std; typedef uint64_t u64; typedef int64_t s64; typedef uint32_t u32; typedef int32_t s32; typedef vector<s32> vs32; typedef vector<u32> vu32; typedef vector<s64> vs64; typedef vector<u64> vu64; const double PI=3.14159265358979323846; #define MAX(x, y) ((x) < (y) ? (y) : (x)) #define MIN(x, y) ((x) > (y) ? (y) : (x)) #define rep(i, N) for(int i = 0; i < N; ++i) #define CEIL(x, y) (((x) + (y) - 1) / (y)) #define MOD 1000000007ULL #define IN(l, r, x) ((l) <= (x) && (x) < (r)) bool ok(vs64 h, s64 a, s64 b, s64 cnt) { for (auto& hp : h) hp -= b * cnt; s64 ret = 0; for (auto& hp : h) ret += CEIL(max(0ll, hp), (a - b)); return ret <= cnt; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; s64 a, b; cin >> a >> b; vs64 h(n); rep (i, n) cin >> h[i]; s64 l = 0, r = 1e9; while (l + 1 < r) { s64 m = (l + r) / 2; if (ok(h, a, b, m)) r = m; else l = m; } cout << r << "\n"; return 0; }
a.cc:20:9: error: 'uint64_t' does not name a type 20 | typedef uint64_t u64; | ^~~~~~~~ a.cc:17:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 16 | #include <numeric> +++ |+#include <cstdint> 17 | a.cc:22:9: error: 'uint32_t' does not name a type 22 | typedef uint32_t u32; | ^~~~~~~~ a.cc:22:9: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:25:16: error: 'u32' was not declared in this scope; did you mean 's32'? 25 | typedef vector<u32> vu32; | ^~~ | s32 a.cc:25:19: error: template argument 1 is invalid 25 | typedef vector<u32> vu32; | ^ a.cc:25:19: error: template argument 2 is invalid a.cc:27:16: error: 'u64' was not declared in this scope; did you mean 's64'? 27 | typedef vector<u64> vu64; | ^~~ | s64 a.cc:27:19: error: template argument 1 is invalid 27 | typedef vector<u64> vu64; | ^ a.cc:27:19: error: template argument 2 is invalid a.cc: In function 'bool ok(vs64, s64, s64, s64)': a.cc:45:39: error: no matching function for call to 'max(long long int, long int&)' 45 | for (auto& hp : h) ret += CEIL(max(0ll, hp), (a - b)); | ~~~^~~~~~~~~ a.cc:36:23: note: in definition of macro 'CEIL' 36 | #define CEIL(x, y) (((x) + (y) - 1) / (y)) | ^ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:45:39: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int') 45 | for (auto& hp : h) ret += CEIL(max(0ll, hp), (a - b)); | ~~~^~~~~~~~~ a.cc:36:23: note: in definition of macro 'CEIL' 36 | #define CEIL(x, y) (((x) + (y) - 1) / (y)) | ^ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:8: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:45:39: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 45 | for (auto& hp : h) ret += CEIL(max(0ll, hp), (a - b)); | ~~~^~~~~~~~~ a.cc:36:23: note: in definition of macro 'CEIL' 36 | #define CEIL(x, y) (((x) + (y) - 1) / (y)) | ^
s397324739
p03700
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n, a, b; cin >> n >> a >> b; int hp[n]; int high = 0; for(int i = 0; i < n; ++i) { cin >> hp[i]; if(high < hp[i]) high = hp[i]; } int max_turn = (high + b -1)/b; max_turn++; int addition = a-b; while(max_turn--){ int cnt = 0; for(int i = 0; i < n; ++i){ if(hp[i] <= (long long)b * (long long)max_turn) continue; else { cnt += (hp[i]-b*max_turn + addition -1)/addition; } } if(cnt > max_turn){ cout << ++max_turn << endl; return; } } return 0; }
a.cc: In function 'int main()': a.cc:25:7: error: return-statement with no value, in function returning 'int' [-fpermissive] 25 | return; | ^~~~~~
s683623400
p03700
C++
#include <bits/stdc++.h> using namespace std; #define ALL(x) (x).begin(),(x).end() #define COUT(x) cout<<(x)<<"\n" #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define REP(i, n) for(int i=0;i<n;i++) #define YES(x) cout<<(x?"YES":"NO")<<"\n" #define Yes(x) cout<<(x?"Yes":"No")<<"\n" #define dump(x) cout<<#x<<" = "<<(x)<<"\n" #define endl "\n" using G = vector<vector<int>>; using M = map<int,int>; using P = pair<int,int>; using PQ = priority_queue<int>; using PQG = priority_queue<int,vector<int>,greater<int>>; using V = vector<int>; using ll = long long; using edge = struct { int to; int cost; }; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } const int INF = 1e9; const int MOD = 1e9+7; const ll LINF = 1e18; int n,a,b; vector<int> h; bool enough(int idx, ll mid, ll k) { ll k = b * mid; for (int i = idx; i < n; i++) { ll nh = h[i]-k; mid -= nh/(a-b) + (nh%(a-b) > 0); } return 0 <= mid; } int main() { IOS; cin >> n >> a >> b; h.resize(n); REP(i,n) cin >> h[i]; sort(ALL(h)); int ng = 0, ok = h[n-1]/b+1; while(abs(ok-ng) > 1) { ll mid = (ok+ng)/2; ll key = b * mid; auto it = upper_bound(ALL(h), key); int idx = it-h.begin(); if (enough(idx, mid, key)) ok = mid; else ng = mid; } COUT(ok); return 0; }
a.cc: In function 'bool enough(int, ll, ll)': a.cc:29:6: error: declaration of 'll k' shadows a parameter 29 | ll k = b * mid; | ^ a.cc:28:33: note: 'll k' previously declared here 28 | bool enough(int idx, ll mid, ll k) { | ~~~^
s998793018
p03700
C++
#include <bits/stdc++.h> using namespace std; #define ALL(x) (x).begin(),(x).end() #define COUT(x) cout<<(x)<<"\n" #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define REP(i, n) for(int i=0;i<n;i++) #define YES(x) cout<<(x?"YES":"NO")<<"\n" #define Yes(x) cout<<(x?"Yes":"No")<<"\n" #define dump(x) cout<<#x<<" = "<<(x)<<"\n" #define endl "\n" using G = vector<vector<int>>; using M = map<int,int>; using P = pair<int,int>; using PQ = priority_queue<int>; using PQG = priority_queue<int,vector<int>,greater<int>>; using V = vector<int>; using ll = long long; using edge = struct { int to; int cost; }; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } const int INF = 1e9; const int MOD = 1e9+7; const ll LINF = 1e18; int n,a,b; vector<int> h; bool enough(int idx, ll mid) { ll k = b * mid; // for (int i = idx; i < n; i++) { ll nh = h[i]-k; mid -= nh/(a-b) + (nh%(a-b) > 0); } return 0 <= mid; } int main() { IOS; cin >> n >> a >> b; h.resize(n); REP(i,n) cin >> h[i]; sort(ALL(h)); int ng = 0, ok = h[n-1]/b+1; while(abs(ok-ng) > 1) { ll mid = (ok+ng)/2; auto it = upper_bound(ALL(h), key); int idx = it-h.begin(); if (enough(idx, mid)) ok = mid; else ng = mid; } COUT(ok); return 0; }
a.cc: In function 'int main()': a.cc:48:35: error: 'key' was not declared in this scope; did you mean 'key_t'? 48 | auto it = upper_bound(ALL(h), key); | ^~~ | key_t
s852059234
p03700
C
/* C++ */ #include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll,ll> pint; const int MAX = 510000; const int MOD = 1000000007; #define rep(i, n) for(ll i = ll(0); i < ll(n); i++) #define Rep(i, n) for(ll i = ll(1); i < ll(n); i++) #define ALL(a) (a).begin(),(a).end() #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define PI 3.14159265358979323846 #define ifYN(x) cout<<(x?"Yes":"No")<<"\n" ll fac[MAX], finv[MAX], inv[MAX]; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } bool palindrome(string s){ bool flag=true; rep(i,(ll)s.size()) if(s[i]!=s[s.size()-1-i]) flag=false; return flag; } // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (ll i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } ll Len(ll n) { ll s=0; while(n!=0) s++, n/=10; return s; } ll Sint(ll n) { ll ans=0; while(n!=0) ans+=n%10,n/=10; return ans; } ll Svec(vector<ll> v){ ll n=0; rep(i,(ll)v.size()) n+=v[i]; return n; } ll GCD(ll a,ll b) { return b ? GCD(b,a%b) : a; } ll LCM(ll a,ll b){ return a/GCD(a,b)*b; } ll Factorial(ll n){ ll m=1; while(n>=1) m*=n,n--; return m; } void runlength(string s,vector<pair<char,ll>> &p){ ll x=1; if(s.size()==1){ p.push_back(pair<char,ll>(s[0],1)); } rep(i,(ll)s.size()-1){ if(s[i]==s[i+1]){ x++; if(i==(ll)s.size()-2){ p.push_back(pair<char,ll>(s[i],x)); } }else{ p.push_back(pair<char,ll>(s[i],x)); x=1; if(i==(ll)s.size()-2){ p.push_back(pair<char,ll>(s[s.size()-1],x)); } } } } ll COM(ll n,ll k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } ll modpow(ll a, ll n, ll mod) { ll res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } string Toupper(string s){ string ans=""; rep(i,s.size()){ if('a'<=s[i] && s[i]<='z') ans+=(char)s[i]-32; else ans+=s[i]; } return ans; } string Tolower(string s){ string ans=""; rep(i,s.size()){ if('A'<=s[i] && s[i]<='Z') ans+=(char)s[i]+32; else ans+=s[i]; } return ans; } void dis(vector<ll> v){ rep(i,v.size()) cout<<v[i]<<endl; } void dis2(vector<vector<ll>> v){ rep(i,v.size()){ rep(j,v[0].size()) cout<<v[i][j]<<' '; cout<<endl; } } const int MAX_N=100010; vector<bool> sieve_of_eratosthenes(){ vector<bool> isPrime(MAX_N+1,true); /* isPrime[1]=false; */ for(int i=2;i<=MAX_N;i++){ if(isPrime[i]){ for(int j=2*i;j<=MAX_N;j+=i){ isPrime[j]=false; } } } return isPrime; } vector<pint> prime_factorize(ll n){ vector<pint> ans; for(ll p=2;p<=sqrt(n);p++){ if(n%p!=0) continue; ll cnt=0; while(n%p==0){ n/=p; cnt++; } ans.push_back(make_pair(p,cnt)); } if(n!=1) ans.push_back(make_pair(n,1)); return ans; } /*bool cmp(pint a, pint b) { return a.second < b.second; }*/ ll solve(ll mid,vector<ll> v,ll a,ll b){ ll sum=0; rep(i,v.size()){ v[i]-=mid*b; } rep(i,v.size()){ if(v[i]<0) continue; sum+=v[i]/(a-b); } return sum; } /*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/ int main() { IOS; ll n,a,b; cin>>n>>a>>b; vector<ll> v(n); rep(i,n) cin>>v[i]; ll ok=1000000000; ll ng=-1; while(abs(ok-ng)>1){ ll mid=(ok+ng)/2; if(solve(mid,v,a,b)<=mid) ok=mid; else ng=mid; } cout<<ok<<endl; }
main.c:2:9: fatal error: bits/stdc++.h: No such file or directory 2 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s525710903
p03700
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define fi first #define se second #define sz size() #define bgn begin() #define en end() #define pb push_back #define pp() pop_back() #define V vector #define P pair #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(),a.end()),a.end()) #define Q queue #define pri priority_queue #define Pri priority_queue<int,vector<int>,greater<int>> #define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>> #define ff first.first #define fs first.second #define sf second.first #define ss second.second #define all(a) (a).begin(),(a).end() #define elif else if int low(V<int> &a,int b){ auto c=lower_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } int upp(V<int> &a,int b){ auto c=upper_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } template<class T> void cou(vector<vector<T>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } } int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } int gcm(int a,int b){ if(a%b==0) return b; return gcm(b,a%b); } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; for(int i=3;i<=sqrt(a)+1;i+=2){ if (a%i==0) return false; } return true; } struct Union{ vector<int> par; Union(int a){ par=vector<int>(a,-1); } int find(int a){ if(par[a]<0) return a; else return par[a]=find(par[a]); } bool same(int a,int b){ return find(a)==find(b); } int Size(int a){ return -par[find(a)]; } void unite(int a,int b){ a=find(a); b=find(b); if(a==b) return; if(Size(b)>Size(a)) swap<int>(a,b); par[a]+=par[b]; par[b]=a; } }; int ketas(int a){ string b=to_string(a); int c=0; fo(i,keta(a)){ c+=b[i]-'0'; } return c; } bool fe(int a,int b){ a%=10; b%=10; if(a==0) a=10; if(b==0) b=10; if(a>b) return true; else return false; } int INF=1000000007; struct edge{int s,t,d; }; V<int> mojisyu(string a){ V<int> b(26,0); fo(i,a.sz){ b[a[i]-'a']++; } return b; } int wa2(int a){ if(a%2==1) return a/2; return a/2-1; } /*signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } } ?*/ int nCr(int n,int r){ int a=1; r=min(r,n-r); for(int i=n;i>n-r;i--){ a*=i; a/=n-i+1; } return a; } /*void sea(int x,int y){ if(x<0||a<=x||y<0||b<=y||c[x][y]=='#') return; if(d[x][y]) return; d[x][y]++; sea(x+1,y); sea(x-1,y); sea(x,y+1); sea(x,y-1); }*/ int kaijou(int a){ int b=1; fo(i,a) b*=i+1; return b; } int nPr(int a,int b){ if(a<b) return 0; if(b==0) return 1; int c=1; for(int i=a;i>a-b;i--){ c*=i; c%=INF; } return c; } long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } // a^{-1} mod を計算する long long modinv(long long a, long long mod) { return modpow(a, mod - 2, mod); } int lcm(int a,int b){ int c=modinv(gcm(a,b),INF); return ((a*c)%INF)*(b%INF)%INF; } int MOD=INF; int fac[1000010], finv[1000010], inv[1000010]; // テーブルを作る前処理 //先にCOMinit()で前処理をする //ABC145D void COMinit() { fac[0]=fac[1]=1; finv[0]=finv[1]=1; inv[1]=1; for(int i=2;i<1000010;i++){ fac[i]=fac[i-1]*i%MOD; inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD; finv[i]=finv[i-1]*inv[i]%MOD; } } // 二項係数計算 int COM(int n,int k){ if(n<k) return 0; if(n<0||k<0) return 0; return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD; } bool naka(int a,int b,V<V<char>> c){ return (a>=0&&b>=0&&a<c.sz&&b<c[0].sz); } V<P<int,int>> mawari8={{0,-1},{0,1},{1,0},{-1,0},{-1,-1},{1,1},{1,-1},{-1,-1}}; int inf=1000000000000000007; V<P<int,int>> mawari4={{0,-1},{0,1},{1,0},{-1,0}}; //最短経路の表 a(全部INFで初期化) //縦横 x,y //迷路 f //スタートsx,sy //ゴールgx,gy //文字はgから使おうね /*int bfs_haba(){ Q<P<int,int>> b; a[sx][sy]=0; b.push({sx,sy}); while(!b.empty()){ P<int,int> c=b.front(); b.pop(); if(c.fi==gx&&c.se==gy){ break; } fo(i,4){ int d=c.fi+mawari4[i].fi; int e=c.se+mawari4[i].se; if(0<=d&&0<=e&&d<x&&e<y&&f[d][e]!='#'&&a[d][e]==INF){ b.push({d,e}); a[d][e]=1+a[c.fi][c.se]; } } } return a[gx][gy]; }*/ V<int> onajibubun(string a){ V<int> b(a.sz); for(int i=1,j=0;i<a.sz;i++){ if(i+b[i-j]<j+b[j]) b[i]=b[i-j]; else{ int c=max<int>(0,j+b[j]-i); while(i+c<a.sz&&a[c]==a[i+c]) c++; b[i]=c; j=i; } } b[0]=a.sz; return b; } //各頂点ごとにどこに辺が出てるかの表がc //各頂点ごとの色を表すV<int>(頂点数max)のcolorを用意する //aはどこ塗るか、bは何で塗るかなので、(0,1,c)でよぶとおけ V<int> color(200005); bool nibu_hantei(int a,int b,V<V<int>> c){ color[a]=b; fo(i,c[a].sz){ if(b==color[c[a][i]]) return false; if(color[c[a][i]]==0&&!nibu_hantei(c[a][i],-b,c)) return false; } return true; } //aは頂点数 //nibu_hanteiの上にcolorを用意する //各頂点ごとにどこに辺が出てるかの表がc bool renketujanai_nibu_hantei(int a,V<V<int>> c){ fo(i,a){ if(color[i]==0){ if(!nibu_hantei(i,1,c)) return false; } } return true; } struct segmin{ vector<int> seg; int b; segmin(V<int> a){ b=1; while(b<a.sz) b*=2; seg=vector<int>(2*b-1,inf); fo(i,a.sz){ seg[i+b-1]=a[i]; } for(int i=b-2;i>=0;i--){ seg[i]=min(seg[2*i+1],seg[2*i+2]); } } void update(int i,int a){ i+=b-1; seg[i]=a; while(i){ i=(i-1)/2; seg[i]=min(seg[2*i+1],seg[2*i+2]); } } //最初呼び出すときは要求区間x,y+1(yは添え字+1)とa=0,l=0,r=INFで //l,rは探すところ int getmin(int x,int y,int a,int l,int r){ if(r==INF) r=b; if(r<=x||y<=l) return INF; if(x<=l&&r<=y) return seg[a]; int a1=getmin(x,y,2*a+1,l,(l+r)/2); int a2=getmin(x,y,2*a+2,(l+r)/2,r); return min(a1,a2); } }; struct segadd{ vector<int> seg; int b; segadd(V<int> a){ b=1; while(b<a.sz) b*=2; seg=vector<int>(2*b-1,0); fo(i,a.sz){ seg[i+b-1]=a[i]; } for(int i=b-2;i>=0;i--){ seg[i]=seg[2*i+1]+seg[2*i+2]; } } void update(int i,int a){ i+=b-1; seg[i]=a; while(i){ i=(i-1)/2; seg[i]=seg[2*i+1]+seg[2*i+2]; } } //最初呼び出すときは要求区間x,y+1(yは添え字+1)とa=0,l=0,r=INFで //l,rは探すところ int getadd(int x,int y,int a,int l,int r){ if(r==INF) r=b; if(r<=x||y<=l) return 0; if(x<=l&&r<=y) return seg[a]; int a1=getadd(x,y,2*a+1,l,(l+r)/2); int a2=getadd(x,y,2*a+2,(l+r)/2,r); return a1+a2; } }; struct sege{ vector<P<int,V<int>>> seg; int b; sege(string a){ b=1; while(b<a.sz) b*=2; seg=vector<P<int,V<int>>>(2*b-1); fo(i,a.sz){ seg[i+b-1].fi=1; seg[i+b-1].se.pb(a[i]-'a'); } for(int i=b-2;i>=0;i--){ V<int> d=seg[2*i+1].se; fo(j,seg[2*i+2].se.sz){ d.pb(seg[2*i+2].se[j]); } Sort(d); uni(d); seg[i].se=d; seg[i].fi=d.sz; } } V<int> mu; void update(int i,char a){ i+=b-1; seg[i].se=mu; seg[i].se.pb(a-'a'); seg[i].fi=1; while(i){ i=(i-1)/2; V<int> d=seg[2*i+1].se; fo(j,seg[2*i+2].se.sz){ d.pb(seg[2*i+2].se[j]); } Sort(d); uni(d); seg[i].se=d; seg[i].fi=d.sz; } } void unko(){ fo(i,2*b-1) cout<<seg[i].fi<<' '; } //最初呼び出すときは要求区間x,y+1(yは添え字+1)とa=0,l=0,r=INFで //l,rは探すところ P<int,V<int>> gete(int x,int y,int a,int l,int r){ if(r==INF) r=b; if(r<=x||y<=l) return {0,mu}; if(x<=l&&r<=y) return seg[a]; P<int,V<int>> a1=gete(x,y,2*a+1,l,(l+r)/2); P<int,V<int>> a2=gete(x,y,2*a+2,(l+r)/2,r); fo(i,a2.se.sz) a1.se.pb(a2.se[i]); Sort(a1.se); uni(a1.se); return {a1.se.sz,a1.se}; } };/* signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } }*/ //aのb乗mod c int kurikaesijijou(int a,int b,int c){ a%=c; b%=c; if(b==0) return 1; if(b%2==0){ int d=kurikaesijijou(a,b/2,c); d%=c; return d*d%c; } return a*kurikaesijijou(a,b-1,c)%c; } int waINF(int a){ if(a>=0) return a%INF; return (a+INF*INF)%INF; } signed main(){ int a,b,c; cin>>a>>b>>c; V<int> d(a); fo(i,a) cin>>d[i]; Sort(d); rev(d); int e,l=0;r=d[0]/c+1; while(1){ e=(l+r)/2; if(e==l||e==r) break; int f=0; fo(i,a){ f+=(d[i]-(b-c)*e+b-c-1)/(b-c); } if(f>e) r=e; else l=e; } cout<<e<<endl; }
a.cc: In function 'int main()': a.cc:535:13: error: 'r' was not declared in this scope 535 | int e,l=0;r=d[0]/c+1; | ^
s379448464
p03700
C++
#include <iostream> #include <algorithm> #include <vector> #include <map> #include <set> #include <queue> #include <iomanip> using namespace std; using i64 = int64_t; #define rep(i, j, n) for(int i = (j); i < (n); ++i) #define rrep(i, j, n) for(int i = (n) - 1; (j) <= i; --i) constexpr i64 MOD = 1000000007; constexpr i64 INF = 1LL << 60; int main() { cin.tie(0); ios_base::sync_with_stdio(false); i64 n, a, b; cin >> n >> a >> b; i64* h = new i64[n]; rep(i, 0, n) cin >> h[i]; auto f = [&](i64 x) { i64 res = 0; rep(i, 0, n) res += max(0LL, ((h[i] - b * x) + a - b - 1) / (a - b)); return x >= res; }; i64 ng = 0, ok = 1 << 30; while (ok - ng > 1) { i64 mid = (ok + ng) >> 1; if (f(mid)) ok = mid; else ng = mid; } cout << ok; delete[] h; return 0; }
a.cc: In lambda function: a.cc:25:40: error: no matching function for call to 'max(long long int, i64)' 25 | rep(i, 0, n) res += max(0LL, ((h[i] - b * x) + a - b - 1) / (a - b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:25:40: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'i64' {aka 'long int'}) 25 | rep(i, 0, n) res += max(0LL, ((h[i] - b * x) + a - b - 1) / (a - b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:25:40: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 25 | rep(i, 0, n) res += max(0LL, ((h[i] - b * x) + a - b - 1) / (a - b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s357853012
p03700
C++
#include <bits/stdc++.h> using namespace std; #define REP(i, s) for (int i = 0; i < s; ++i) #define ALL(v) (v).begin(), (v).end() #define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl #define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i) #define DEBUG #define int long long #define INF 1e18 template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) { return s << '<' << P.first << ", " << P.second << '>'; } template<class T> ostream& operator << (ostream &s, vector<T> P) { for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; } template<class T> ostream& operator << (ostream &s, vector<vector<T> > P) { for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; } template<class T> ostream& operator << (ostream &s, set<T> P) { EACH(it, P) { s << "<" << *it << "> "; } return s << endl; } template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) { EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; } template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";} typedef long long ll; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n ,a, b; cin>>n>>a>>b; vector<int>h(n); for (int i = 0; i < n; i++) { cin>>h[i]; } int l=0; int r=INF; while(l+1<r){ int c=(l+r)/2; vector<int>x(n); int cnt=0; for (int i = 0; i < n; i++) { x[i]=max(h[i]-b*c; , 0LL); cnt+=(x[i]+a-1) /(a); } // cerr<<cnt<<endl; if(cnt<=c){ r=c; } else{ l=c; } } cout<<r<<endl; return 0; }
a.cc: In function 'int main()': a.cc:46:30: error: expected ')' before ';' token 46 | x[i]=max(h[i]-b*c; , 0LL); | ~ ^ | ) a.cc:46:32: error: expected primary-expression before ',' token 46 | x[i]=max(h[i]-b*c; , 0LL); | ^
s395097420
p03700
C++
#include <bits/stdc++.h> using namespace std; #define REP(i, s) for (int i = 0; i < s; ++i) #define ALL(v) (v).begin(), (v).end() #define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl #define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i) #define DEBUG #define int long long #define INF 1e18 template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) { return s << '<' << P.first << ", " << P.second << '>'; } template<class T> ostream& operator << (ostream &s, vector<T> P) { for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; } template<class T> ostream& operator << (ostream &s, vector<vector<T> > P) { for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; } template<class T> ostream& operator << (ostream &s, set<T> P) { EACH(it, P) { s << "<" << *it << "> "; } return s << endl; } template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) { EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; } template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";} typedef long long ll; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n ,a, b; cin>>n>>a>>b; vector<int>h(n); for (int i = 0; i < n; i++) { cin>>h[i]; } int l=0; int r=INF; while(l+1<r){ int c=(l+r)/2; vector<int>x(n); int cnt=0; for (int i = 0; i < n; i++) { x[i]=max(h[i]-b*c; , 0LL) cnt+=(x[i]+a-1) /(a); } // cerr<<cnt<<endl; if(cnt<=c){ r=c; } else{ l=c; } } cout<<r<<endl; return 0; }
a.cc: In function 'int main()': a.cc:46:30: error: expected ')' before ';' token 46 | x[i]=max(h[i]-b*c; , 0LL) | ~ ^ | ) a.cc:46:32: error: expected primary-expression before ',' token 46 | x[i]=max(h[i]-b*c; , 0LL) | ^
s278451665
p03700
C
#include<iostream> #include<vector> #include<algorithm> #include<iterator> #include<cmath> #include<functional> using namespace std; int binsearch(long l, long r, long A, long B, vector<long> h, bool (*ptn)(long, long, long, vector<long>)){ while(r - l > 1){ long m = (l + r) / 2; if(ptn(m, A, B, h)){ l = m; }else{ r = m; } } return l; } bool search(long i, long A, long B, vector<long> h){ if(*max_element(h.begin(), h.end()) <= B*i){ return false; } long r = 0; for(auto j = h.begin(); j < h.end(); j++){ long a = ceil((float(*j) - float(B)*i)/float(A-B)); if(a > 0){ r += a; } } if(r <= i){ return false; } return true; } int main(){ long N, A, B; cin >> N >> A >> B; vector<long> h(N); for(long i=0;i<N;i++){ cin >> h.at(i); } cout << 1 + binsearch(0, 1000000000, A, B, h, search) << endl; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s083548822
p03700
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=int(a);i<int(b);i++) typedef long long ll; typedef pair<ll,ll> P; int main(){ ll n,a,b,h[100010]; cin>>n>>a>>b; rep(i,0,n)cin>>h[i]; ll r=1e11,l=0,c=a-b,mid; while(l+1<r){ mid=(r+l)/2; ll cn=0; rep(i,0,n){ ll tm=(h[i]-b*mid+c-1)/c; cn+=max(tm,0LL); } if(cn<=mid)r=mid; else l=mid; } cout<<r<<endl; } #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=int(a);i<int(b);i++) typedef long long ll; typedef pair<ll,ll> P; int main(){ ll n,a,b,h[100010]; cin>>n>>a>>b; rep(i,0,n)cin>>h[i]; ll r=1e9+1,l=0,c=a-b,mid; while(l+1<r){ mid=(r+l)/2; ll cn=0; rep(i,0,n){ ll tm=(h[i]-b*mid+c-1)/c; cn+=max(tm,0LL); } if(cn<=mid)r=mid; else l=mid; } cout<<r<<endl; }
a.cc:38:5: error: redefinition of 'int main()' 38 | int main(){ | ^~~~ a.cc:8:5: note: 'int main()' previously defined here 8 | int main(){ | ^~~~
s173794636
p03700
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <utility> #include <tuple> #include <queue> #include <deque> #include <map> #include <set> #include <cmath> #include <iomanip> #include <functional> #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define REP(i, n) for (int i = 1; i < (int)(n); ++i) using namespace std; using lint = int64_t; int main() { int N; lint A, B; cin >> N >> A >> B; vector<lint> h(N); rep(i, N) cin >> h[i]; int left = 0; int right = 1000000000; while (right - left > 1) { int mid = (right + left) / 2; auto H = h; rep(i, N) H[i] -= B * mid; lint cnt = 0; rep(i, N) cnt += max(0LL, (H[i] - 1 + (A - B)) / (A - B)); if (cnt <= mid) right = mid; else left = mid; } cout << right << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:33:29: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)' 33 | rep(i, N) cnt += max(0LL, (H[i] - 1 + (A - B)) / (A - B)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:33:29: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'}) 33 | rep(i, N) cnt += max(0LL, (H[i] - 1 + (A - B)) / (A - B)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:4: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:33:29: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 33 | rep(i, N) cnt += max(0LL, (H[i] - 1 + (A - B)) / (A - B)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s511371759
p03700
C++
#include <bits/stdc++.h> #include <boost/range/adaptors.hpp> #include <boost/range/irange.hpp> using namespace std; using namespace boost; using namespace boost::adaptors; int main() { int64_t n, a, b; cin >> n >> a >> b; vector<int64_t> h(n); for (auto&& hh : h) { cin >> hh; } auto can_beat = [&](int64_t m) { int64_t t = 0; for (auto hh : h) { auto h1 = hh - m * b; if (h1 > 0) { t += (h1 - 1) / (a - b) + 1; } } return t <= m; }; auto r = irange(0L, 1000000001L); auto ans = *partition_point(r.begin(), r.end(), not_fn(can_beat)); cout << ans << endl; }
a.cc:3:10: fatal error: boost/range/adaptors.hpp: No such file or directory 3 | #include <boost/range/adaptors.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s707774461
p03700
C++
a
a.cc:1:1: error: 'a' does not name a type 1 | a | ^
s511471340
p03700
C++
#include<bits/stdc++.h> #define rep(i, n) for (int i=0;i<(n);i++) using namespace std; typedef long long ll; ll INF = 1e18; /*解説AC*/ ll n, a, b; vector<ll>v; bool enough(ll t){ ll tmp = 0; rep(i, n){ /*a-b-1してから割ると良い*/ tmp += max(0, (v[i]-t*b+(a-b)-1)/(a-b)); } if(tmp<=t) return true; else return false; } int main(void){ cin>>n>>a>>b; v.resize(n); rep(i, n) cin>>v[i]; ll left=0; ll right=INF; while((right-left)>1){ ll mid=(left+right)/2; if(enough(mid)) right=mid; else left=mid; } cout<<right<<endl; return 0; }
a.cc: In function 'bool enough(ll)': a.cc:16:19: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 16 | tmp += max(0, (v[i]-t*b+(a-b)-1)/(a-b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:16:19: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 16 | tmp += max(0, (v[i]-t*b+(a-b)-1)/(a-b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:16:19: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 16 | tmp += max(0, (v[i]-t*b+(a-b)-1)/(a-b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s431468198
p03700
C++
// cannot solve
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s159622564
p03700
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++) #define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++) #define MOD 1000000007 #define int long long #define ALL(a) (a).begin(),(a).end() #define vi vector<int> #define vii vector<vi> #define pii pair<int,int> #define priq priority_queue<int> #define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key))) #define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key))) #define tii tuple<int,int,int> #define Priq priority_queue<int,vi,greater<int>> #define pb push_back #define mp make_pair #define INF (1ll<<50) int N,A,B; int C[100000]; int func(X){ int ret=0; rep(i,0,N){ ret+=max(0ll,(C[i]-B*X)+A-B-1)/(A-B); } return ret; } signed main(){ cin>>N>>A>>B; rep(i,0,N) C[i]; int left=0,right=INF; while(left+1<right){ int mid=(left+right)/2; if(func(mid)<=mid) right=mid; else left=mid; } int ans=right; if(func(left)<=left) ans=left; cout<<ans<<endl; }
a.cc:21:10: error: 'X' was not declared in this scope 21 | int func(X){ | ^ a.cc: In function 'int main()': a.cc:34:12: error: 'func' cannot be used as a function 34 | if(func(mid)<=mid) right=mid; | ~~~~^~~~~ a.cc:38:10: error: 'func' cannot be used as a function 38 | if(func(left)<=left) ans=left; | ~~~~^~~~~~
s290276315
p03700
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int a = scan.nextInt(); int b = scan.nextInt(); int[] h = new int[n]; long s = 0; for (int i = 0; i < n; i++) { h[i] = scan.nextInt(); s += (h[i] - 1) / a + 1; } long left = -1; long right = s; while (right - left > 1) { long mid = (left + right) / 2; if (possible(a, b, h, mid)) { right = mid; } else { left = mid; } } System.out.println(right); } private static boolean possible(int A, int B, int[] h_array, long p_maxp_maxp_max) { long p = 0; for (int h : h_array) { if (h <= p_maxp_maxp_max * B) { continue; } long pi = (h - p_maxp_max * B - 1) / (A - B) + 1; p += pi; if (p > p_max){ return false; } } return true; } }
Main.java:34: error: cannot find symbol long pi = (h - p_maxp_max * B - 1) / (A - B) + 1; ^ symbol: variable p_maxp_max location: class Main Main.java:36: error: cannot find symbol if (p > p_max){ ^ symbol: variable p_max location: class Main 2 errors
s510144676
p03700
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < n; ++i) #define ALL(v) v.begin(), v.end() typedef long long ll; typedef pair<int, int> P; const int INF = 1000000001; ll n,a,b,c; bool bin(vector<ll> h,ll t) { ll at= 0; rep(i,n) { h[i] -= t*b; at += (max(0,h[i])+c-1)/c; } if(at>t) { return false; } return true; } int main() { cin >> n >> a >> b; c = a - b; vector<ll> h(n); rep(i,n)cin >> h[i]; int left = -1,right = INF; while(1) { ll mid = (left+right)/2; if(bin(h,mid)) { right = mid; } else { left = mid; } //cout<<left<<';'<<right<<endl; if(right-left<=1)break; } cout<<right<<endl; return 0; }
a.cc: In function 'bool bin(std::vector<long long int>, ll)': a.cc:16:17: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)' 16 | at += (max(0,h[i])+c-1)/c; | ~~~^~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:16:17: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 16 | at += (max(0,h[i])+c-1)/c; | ~~~^~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:16:17: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 16 | at += (max(0,h[i])+c-1)/c; | ~~~^~~~~~~~
s765691157
p03700
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < n; ++i) #define ALL(v) v.begin(), v.end() typedef long long ll; typedef pair<int, int> P; const int INF = 1000000001; ll n,a,b,c; bool bin(vector<ll> h,ll t) { ll at= 0; rep(i,n) { h[i] -= t*b; at += (max(0,h[i])+c-1)/c; } if(at>t) { return false; } return true; } int main() { cin >> n >> a >> b; c = a - b; vector<llogbf128> h(n); rep(i,n)cin >> h[i]; int left = -1,right = INF; while(1) { ll mid = (left+right)/2; if(bin(h,mid)) { right = mid; } else { left = mid; } //cout<<left<<';'<<right<<endl; if(right-left<=1)break; } cout<<right<<endl; return 0; }
a.cc: In function 'bool bin(std::vector<long long int>, ll)': a.cc:16:17: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)' 16 | at += (max(0,h[i])+c-1)/c; | ~~~^~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:16:17: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 16 | at += (max(0,h[i])+c-1)/c; | ~~~^~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:16:17: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 16 | at += (max(0,h[i])+c-1)/c; | ~~~^~~~~~~~ a.cc: In function 'int main()': a.cc:30:20: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector' 30 | vector<llogbf128> h(n); | ^ a.cc:30:20: note: expected a type, got 'llogbf128' a.cc:30:20: error: template argument 2 is invalid a.cc:31:20: error: invalid types 'int[int]' for array subscript 31 | rep(i,n)cin >> h[i]; | ^ a.cc:36:14: error: could not convert 'h' from 'int' to 'std::vector<long long int>' 36 | if(bin(h,mid)) | ^ | | | int
s847233190
p03700
C++
clude <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef pair<int,int> P; int main(){ int n, a, b; cin >> n >> a >> b; vector<int> h(n); rep(i,n) cin >> h[i]; auto ok = [&](ll m) { ll cnt = 0; for (int i = 0; i < n; i++) { if (h[i] > b * m) { cnt += ((h[i] - b * m + (a-b-1))/(a-b)); } } return cnt > m; }; ll l = 0, r = 1e9; while (r - l > 1) { int m = (r + l) / 2; if (ok(m)) l = m; else r = m; } cout << r << endl; return 0; }
a.cc:1:1: error: 'clude' does not name a type 1 | clude <bits/stdc++.h> | ^~~~~ a.cc:6:9: error: 'pair' does not name a type 6 | typedef pair<int,int> P; | ^~~~ a.cc: In function 'int main()': a.cc:10:3: error: 'cin' was not declared in this scope 10 | cin >> n >> a >> b; | ^~~ a.cc:11:3: error: 'vector' was not declared in this scope 11 | vector<int> h(n); | ^~~~~~ a.cc:11:10: error: expected primary-expression before 'int' 11 | vector<int> h(n); | ^~~ a.cc:12:19: error: 'h' was not declared in this scope 12 | rep(i,n) cin >> h[i]; | ^ a.cc: In lambda function: a.cc:17:11: error: 'h' was not declared in this scope 17 | if (h[i] > b * m) { | ^ a.cc: In function 'int main()': a.cc:30:3: error: 'cout' was not declared in this scope 30 | cout << r << endl; | ^~~~ a.cc:30:16: error: 'endl' was not declared in this scope 30 | cout << r << endl; | ^~~~
s410684587
p03700
C++
clude <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef pair<int,int> P; int main(){ int n, a, b; cin >> n >> a >> b; vector<int> h(n); rep(i,n) cin >> h[i]; auto ok = [&](ll m) { ll cnt = 0; for (int i = 0; i < n; i++) { if (h[i] > b * m) { cnt += ((h[i] - b * m + (a-b-1))/(a-b)); } } return cnt > m; }; ll l = 0, r = 1e9; while (r - l > 1) { int m = (r + l) / 2; if (ok(m)) l = m; else r = m; } cout << r << endl; return 0; }
a.cc:1:1: error: 'clude' does not name a type 1 | clude <bits/stdc++.h> | ^~~~~ a.cc:6:9: error: 'pair' does not name a type 6 | typedef pair<int,int> P; | ^~~~ a.cc: In function 'int main()': a.cc:10:3: error: 'cin' was not declared in this scope 10 | cin >> n >> a >> b; | ^~~ a.cc:11:3: error: 'vector' was not declared in this scope 11 | vector<int> h(n); | ^~~~~~ a.cc:11:10: error: expected primary-expression before 'int' 11 | vector<int> h(n); | ^~~ a.cc:12:19: error: 'h' was not declared in this scope 12 | rep(i,n) cin >> h[i]; | ^ a.cc: In lambda function: a.cc:17:11: error: 'h' was not declared in this scope 17 | if (h[i] > b * m) { | ^ a.cc: In function 'int main()': a.cc:30:3: error: 'cout' was not declared in this scope 30 | cout << r << endl; | ^~~~ a.cc:30:16: error: 'endl' was not declared in this scope 30 | cout << r << endl; | ^~~~
s109310062
p03700
C++
#pragma GCC optimize ("O3") #include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include <prettyprint.hpp> #define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__); #else #define debug(...) 83; #endif void d_err() { cerr << endl; } template <typename H, typename... T> void d_err(H h, T... t) { cerr << h << " "; d_err(t...); } #define FOR(i, m, n) for (int i = (m); i < (n); ++i) #define REP(i, n) FOR(i, 0, n) #define fi first #define se second #define pb push_back #define mp make_pair #define eb emplace_back #define bcnt __builtin_popcountll typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef pair<ll,ll> Pll; typedef pair<int,int> Pin; ll INF = 1e16; int inf = 1e9; ll MOD = 1e9+7; int main(){ cin.tie(0); ios_base::sync_with_stdio(false); cout << fixed << setprecision(20); int N; ll A, B; cin >> N >> A >> B; vector<ll> h(N); REP(i, N) cin >> h[i]; ll l = 0, r = inf+1; while(r - l > 1) { ll m = (l + r) / 2; debug(l, m, r) ll cnt = 0; REP(i, N) { ll hr = max(h[i] - m * B, 0); cnt += ceil(hr / double(A - B)); } debug(cnt) if (cnt <= m) { r = m; } else { l = m; } } cout << r << endl; }
a.cc: In function 'int main()': a.cc:62:24: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int)' 62 | ll hr = max(h[i] - m * B, 0); | ~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:4: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:62:24: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 62 | ll hr = max(h[i] - m * B, 0); | ~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:62:24: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 62 | ll hr = max(h[i] - m * B, 0); | ~~~^~~~~~~~~~~~~~~~~
s760179583
p03700
C++
#include <bits/stdc++.h> using namespace std; const LL INF = 1e12; LL N, A, B; vector<LL> h; bool f(LL K){ LL tmp = 0; for(int i=0; i<N; i++){ LL rem = h[i]-B*K; if(rem > 0) tmp += (rem+(A-B-1)) / (A-B); } return (tmp <= K); } LL binary_search(LL ok, LL ng){ while (abs(ok - ng) > 1) { LL mid = (ok + ng) / 2; if(f(mid)) ok = mid; else ng = mid; } return ok; } int main(){ cin >> N >> A >> B; h = vector<LL>(N); // サ イ ズ Nを確保 for(int i=0; i<N; i++) cin >> h[i]; cout << binary_search(INF, 0) << endl; }
a.cc:4:7: error: 'LL' does not name a type 4 | const LL INF = 1e12; | ^~ a.cc:6:1: error: 'LL' does not name a type 6 | LL N, A, B; | ^~ a.cc:7:8: error: 'LL' was not declared in this scope 7 | vector<LL> h; | ^~ a.cc:7:10: error: template argument 1 is invalid 7 | vector<LL> h; | ^ a.cc:7:10: error: template argument 2 is invalid a.cc:9:8: error: 'LL' was not declared in this scope 9 | bool f(LL K){ | ^~ a.cc:18:2: error: 'LL' does not name a type 18 | LL binary_search(LL ok, LL ng){ | ^~ a.cc: In function 'int main()': a.cc:28:9: error: 'N' was not declared in this scope 28 | cin >> N >> A >> B; | ^ a.cc:28:14: error: 'A' was not declared in this scope 28 | cin >> N >> A >> B; | ^ a.cc:28:19: error: 'B' was not declared in this scope 28 | cin >> N >> A >> B; | ^ a.cc:29:13: error: 'LL' was not declared in this scope 29 | h = vector<LL>(N); // サ イ ズ Nを確保 | ^~ a.cc:29:15: error: template argument 1 is invalid 29 | h = vector<LL>(N); // サ イ ズ Nを確保 | ^ a.cc:29:15: error: template argument 2 is invalid a.cc:30:33: error: invalid types 'int[int]' for array subscript 30 | for(int i=0; i<N; i++) cin >> h[i]; | ^ a.cc:31:24: error: 'INF' was not declared in this scope 31 | cout << binary_search(INF, 0) << endl; | ^~~
s195570122
p03700
C++
#include<iostream> #include<algorithm> #include<vector> #include<queue> using namespace std; typedef long long ll; #define int ll ll n,a,b; bool judge(vector<ll> vec,ll k){ for(int i=0;i<n;i++) vec[i]-=k*b; queue<ll> que; for(int i=0;i<n;i++) if(vec[i]>0) que.push(vec[i]); ll cnt=0; if(que.empty()) return true; while(!que.empty()){ ll val=que.front(); que.pop(); cnt+=val/(a-b); if(val%(a-b)!=0) cnt++; } if(cnt<=k) return true; else retrun false; } signed main(){ cin>>n>>a>>b; vector<ll> vec; for(int i=0;i<n;i++){ ll a; cin>>a; vec.push_back(a); } ll lb=0,rb=1744174417441744; while(rb-lb>1){ ll mid=(lb+rb)/2; if(judge(vec,mid)) rb=mid; else lb=mid; } cout<<rb<<endl; }
a.cc: In function 'bool judge(std::vector<long long int>, ll)': a.cc:22:8: error: 'retrun' was not declared in this scope 22 | else retrun false; | ^~~~~~ a.cc:23:1: warning: control reaches end of non-void function [-Wreturn-type] 23 | } | ^
s836886652
p03700
Java
import java.util.Scanner; public class Main { static int n, a, b, h[]; public static void main(String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); a = sc.nextInt(); b = sc.nextInt(); h = new int[n]; for(int i=0;i<n;i++)h[i] = sc.nextInt(); sc.close(); int l = 0; int r = (int)1e9+100; while(l+1<r) { int c = (l+r)/2; if(check(c))r = c; else l = c; } System.out.println(r); } static boolean check(int x) { long num = 0; for(int i=0;i<n;i++) { int t = h[i]; t -= b*x; if(t > 0) { num += ((long)t +(a-b-1) )/(a-b); } if(num>x) { return false; } } return true; }
Main.java:40: error: reached end of file while parsing } ^ 1 error
s055180671
p03700
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define repr(i, n) for (int i = (n); i >= 0; --i) #define FOR(i, m, n) for (int i = (m); i < (n); ++i) #define FORR(i, m, n) for (int i = (m); i >= (n); --i) #define equals(a, b) (fabs((a) - (b)) < EPS) using namespace std; typedef long long ll; const ll mod = 1000000007; const ll mod2 = 998244353; const ll INF = 1e9; const long double EPS = 1e-10; int main() { ll n, a, b; cin >> n >> a >> b; vector<ll> h(n); rep(i, n) cin >> h[i]; ll l = 0, r = INF + 1; while (r - l > 1) { ll m = (l + r) / 2; ll cnt = 0; rep(i, n) { cnt += max(0, (h[i] - m * b + a - b - 1) / (a - b)); } if (cnt > m) l = m; else r = m; } cout << r << endl; return 0; }
a.cc: In function 'int main()': a.cc:25:17: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 25 | cnt += max(0, (h[i] - m * b + a - b - 1) / (a - b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:25:17: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 25 | cnt += max(0, (h[i] - m * b + a - b - 1) / (a - b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:25:17: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 25 | cnt += max(0, (h[i] - m * b + a - b - 1) / (a - b)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s672096071
p03700
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define repr(i, n) for (int i = (n); i >= 0; --i) #define FOR(i, m, n) for (int i = (m); i < (n); ++i) #define FORR(i, m, n) for (int i = (m); i >= (n); --i) #define equals(a, b) (fabs((a) - (b)) < EPS) using namespace std; typedef long long ll; const ll mod = 1000000007; const ll mod2 = 998244353; const int INF = 1e9; const long double EPS = 1e-10; int main() { int n, a, b; cin >> n >> a >> b; vector<int> h(n); rep(i, n) cin >> h[i]; int l = 0, r = INF; while (r - l > 1) { ll m = (l + r) / 2; ll cnt = 0; rep(i, n) { int res = max(0, h[i] - m * b); cnt += (res + a - b - 1) / (a - b); } if (cnt > m) l = m; else r = m; } cout << r << endl; return 0; }
a.cc: In function 'int main()': a.cc:25:20: error: no matching function for call to 'max(int, ll)' 25 | int res = max(0, h[i] - m * b); | ~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:25:20: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 25 | int res = max(0, h[i] - m * b); | ~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:25:20: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 25 | int res = max(0, h[i] - m * b); | ~~~^~~~~~~~~~~~~~~~~
s488772997
p03700
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define rep(i,a,b) for(ll i=a;i<b;i++) #define rrep(i,a,b) for(ll i=a;i>=b;i--) #define fore(i,a) for(auto &i:a) #define all(x) (x).begin(),(x).end() #define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) ll binsearch(ll l, ll r, function<bool (ll)> p) { // [l, r), p is monotone assert (l < r); -- l; -- r; // (l, r] while (l + 1 < r) { ll m = (l + r) / 2; (p(m) ? r : l) = m; } return r; // = min { x | p(x) } } int main(void){ ll n, a, b; cin >> n >> a >> b; vector<ll> h(n); rep(i, 0, n){ cin >> h[i]; } ll result = binsearch(0, *whole(max_element, h) + 1, [&](ll m) { ll cnt = 0; rep (i, 0, n) { ll x = h[i] - m * b; if (x >= 0) { cnt += (x + a-b-1) / (a-b); } } return cnt <= m; }); cout << result << endl; return (n)}
a.cc: In function 'int main()': a.cc:43:15: error: expected ';' before '}' token 43 | return (n)} | ^ | ;
s230483075
p03700
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define rep(i,a,b) for(ll i=a;i<b;i++) #define rrep(i,a,b) for(ll i=a;i>=b;i--) #define fore(i,a) for(auto &i:a) #define all(x) (x).begin(),(x).end() #define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) ll binsearch(ll l, ll r, function<bool (ll)> p) { // [l, r), p is monotone assert (l < r); -- l; -- r; // (l, r] while (l + 1 < r) { ll m = (l + r) / 2; (p(m) ? r : l) = m; } return r; // = min { x | p(x) } } int main(void){ ll n, a, b; cin >> n >> a >> b; vector<ll> h(n); rep(i, 0, n){ cin >> h[i]; } ll result = binsearch(0, *whole(max_element, h) + 1, [&](ll m) { ll cnt = 0; rep (i, 0, n) { ll x = h[i] - m * b; if (x >= 0) { cnt += (x + a-b-1) / (a-b); } } return cnt <= m; }); cout << result << endl; return (n)}
a.cc: In function 'int main()': a.cc:43:15: error: expected ';' before '}' token 43 | return (n)} | ^ | ;
s044426580
p03700
Java
import java.util.Scanner; public class mamono { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); long A = scan.nextInt(); long B = scan.nextInt(); long l = 0; long r = 1000000001; long h[] = new long[N]; for (int i = 0; i < N; i++) { h[i] = scan.nextInt(); } while (l < r - 1) { long m = (l + r) / 2; long temp[] = h; for (int i = 0; i < N; i++) { temp[i] -= B * m; } int x = 0; for (int i = 0; i < N; i++) { if (temp[i] > 0) { if (temp[i] % (A - B) == 0) { x += temp[i] / (A - B); } else { x += (temp[i] / (A - B)) + 1; } } } if (x > m) l = m; else r = m; } System.out.println(r+1); } }
Main.java:2: error: class mamono is public, should be declared in a file named mamono.java public class mamono { ^ 1 error
s928961617
p03700
C++
#include <bits/stdc++.h> using namespace std; #define ll long long #define fw(p) for(int w=0;w<(p);w++) #define fx(p) for(int x=0;x<(p);x++) #define fy(p) for(int y=0;y<(p);y++) #define fz(p) for(int z=0;z<(p);z++) #define fyg(p,g) for(int y=(g);y<(p);y++) #define fzg(p,g) for(int z=(g);z<(p);z++) #define ce(d) cout<<d<<endl; #define vecp(p) int aa;cin>>aa;(p).push_back(aa); #define vecpl(p) long long aa;cin>>aa;(p).push_back(aa); #define vecps(p) string aa;cin>>aa;(p).push_back(aa); #define vecp2(p) cin>>aa;(p).push_back(aa); #define vecpl2(p) long long a b;cin>>ab;(p).push_back(ab); #define vecps2(p) string ab;cin>>ab;(p).push_back(ab); #define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); } #define sorts(c) sort((c).begin(),(c).end()); #define reverses(c) reverse((c).begin(),(c).end()); #define vec(b) vector<int> (b); #define vecl(b) vector<long long> (b); #define vecs(b) vector<string> (b); #define vecsize(b,size) vector<int> (b)((size)); #define pb(b,a) (b).push_back((a)); #define doublece(a,b) cout<<(a)<<' '<<(b)<<endl; #define pairs(s) vector<pair<int,int>> (s); #define pairsl(s) vector<pair<ll,ll>> (s); #define pairss(s) vector<pair<string,string>> (s); #define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb)); #define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb)); #define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb)); #define pairsREV(s) (s).push_back(make_pair(bb,aa)); #define pairslREV(s) (s).push_back(make_pair(bb,aa)); #define pairssREV(s) (s).push_back(make_pair(bb,aa)); #define MOD 1000000007 int main() { ll N,A,B; cin >> N>>A>>B; vecl(H); fx(N) { vecpl(H); } A -= B; ll left = 0, right = 2000000000; ll mid; fx(50) { mid = (left + right) / 2; int k = mid; fy(N) { if (H[y] >mid*B) { ll tmp = (H[y] - mid * B); k -= (tmp + A - 1) / A; //at = mid- k; } } if (k>0) { right = mid; } else { left = mid; } } #include <bits/stdc++.h> using namespace std; #define ll long long #define fw(p) for(int w=0;w<(p);w++) #define fx(p) for(int x=0;x<(p);x++) #define fy(p) for(int y=0;y<(p);y++) #define fz(p) for(int z=0;z<(p);z++) #define fyg(p,g) for(int y=(g);y<(p);y++) #define fzg(p,g) for(int z=(g);z<(p);z++) #define ce(d) cout<<d<<endl; #define vecp(p) int aa;cin>>aa;(p).push_back(aa); #define vecpl(p) long long aa;cin>>aa;(p).push_back(aa); #define vecps(p) string aa;cin>>aa;(p).push_back(aa); #define vecp2(p) cin>>aa;(p).push_back(aa); #define vecpl2(p) long long a b;cin>>ab;(p).push_back(ab); #define vecps2(p) string ab;cin>>ab;(p).push_back(ab); #define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); } #define sorts(c) sort((c).begin(),(c).end()); #define reverses(c) reverse((c).begin(),(c).end()); #define vec(b) vector<int> (b); #define vecl(b) vector<long long> (b); #define vecs(b) vector<string> (b); #define vecsize(b,size) vector<int> (b)((size)); #define pb(b,a) (b).push_back((a)); #define doublece(a,b) cout<<(a)<<' '<<(b)<<endl; #define pairs(s) vector<pair<int,int>> (s); #define pairsl(s) vector<pair<ll,ll>> (s); #define pairss(s) vector<pair<string,string>> (s); #define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb)); #define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb)); #define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb)); #define pairsREV(s) (s).push_back(make_pair(bb,aa)); #define pairslREV(s) (s).push_back(make_pair(bb,aa)); #define pairssREV(s) (s).push_back(make_pair(bb,aa)); #define MOD 1000000007 int main() { ll N,A,B; cin >> N>>A>>B; vecl(H); fx(N) { vecpl(H); } A -= B; ll left = 0, right = 2000000000; ll mid; fx(50) { mid = (left + right) / 2; int k = mid; fy(N) { if (H[y] >mid*B) { ll tmp = (H[y] - mid * B); k -= (tmp + A - 1) / A; //at = mid- k; } } if (k>=0) { right = mid; } else { left = mid; } } right++; left++; ll k = left; fy(N) { if (H[y] > left* B) { ll tmp = (H[y] - left * B); k -= (tmp + A - 1) / A; } } //doublece(left,right) if (k>=0) { ce(left) } else { ce(right) } return 0; }
a.cc: In function 'int main()': a.cc:104:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 104 | int main() | ^~ a.cc:104:9: note: remove parentheses to default-initialize a variable 104 | int main() | ^~ | -- a.cc:104:9: note: or replace parentheses with braces to value-initialize a variable a.cc:105:1: error: a function-definition is not allowed here before '{' token 105 | { | ^ a.cc:152:2: error: expected '}' at end of input 152 | } | ^ a.cc:39:1: note: to match this '{' 39 | { | ^
s454195424
p03700
C++
#include <bits/stdc++.h> using namespace std; #define ll long long #define fw(p) for(int w=0;w<(p);w++) #define fx(p) for(int x=0;x<(p);x++) #define fy(p) for(int y=0;y<(p);y++) #define fz(p) for(int z=0;z<(p);z++) #define fyg(p,g) for(int y=(g);y<(p);y++) #define fzg(p,g) for(int z=(g);z<(p);z++) #define ce(d) cout<<d<<endl; #define vecp(p) int aa;cin>>aa;(p).push_back(aa); #define vecpl(p) long long aa;cin>>aa;(p).push_back(aa); #define vecps(p) string aa;cin>>aa;(p).push_back(aa); #define vecp2(p) cin>>aa;(p).push_back(aa); #define vecpl2(p) long long a b;cin>>ab;(p).push_back(ab); #define vecps2(p) string ab;cin>>ab;(p).push_back(ab); #define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); } #define sorts(c) sort((c).begin(),(c).end()); #define reverses(c) reverse((c).begin(),(c).end()); #define vec(b) vector<int> (b); #define vecl(b) vector<long long> (b); #define vecs(b) vector<string> (b); #define vecsize(b,size) vector<int> (b)((size)); #define pb(b,a) (b).push_back((a)); #define doublece(a,b) cout<<(a)<<' '<<(b)<<endl; #define pairs(s) vector<pair<int,int>> (s); #define pairsl(s) vector<pair<ll,ll>> (s); #define pairss(s) vector<pair<string,string>> (s); #define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb)); #define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb)); #define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb)); #define pairsREV(s) (s).push_back(make_pair(bb,aa)); #define pairslREV(s) (s).push_back(make_pair(bb,aa)); #define pairssREV(s) (s).push_back(make_pair(bb,aa)); #define MOD 1000000007 int main() { ll N,A,B; cin >> N>>A>>B; vecl(H); fx(N) { vecpl(H); } A -= B; ll left = 0, right = 2000000000; ll mid; fx(50) { mid = (left + right) / 2; int k = mid; fy(N) { if (H[y] >mid*B) { ll tmp = (H[y] - mid * B); k -= (tmp + A - 1) / A; //at = mid- k; } } if (k>0) { right = mid; } else { left = mid; } } #include <bits/stdc++.h> using namespace std; #define ll long long #define fw(p) for(int w=0;w<(p);w++) #define fx(p) for(int x=0;x<(p);x++) #define fy(p) for(int y=0;y<(p);y++) #define fz(p) for(int z=0;z<(p);z++) #define fyg(p,g) for(int y=(g);y<(p);y++) #define fzg(p,g) for(int z=(g);z<(p);z++) #define ce(d) cout<<d<<endl; #define vecp(p) int aa;cin>>aa;(p).push_back(aa); #define vecpl(p) long long aa;cin>>aa;(p).push_back(aa); #define vecps(p) string aa;cin>>aa;(p).push_back(aa); #define vecp2(p) cin>>aa;(p).push_back(aa); #define vecpl2(p) long long a b;cin>>ab;(p).push_back(ab); #define vecps2(p) string ab;cin>>ab;(p).push_back(ab); #define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); } #define sorts(c) sort((c).begin(),(c).end()); #define reverses(c) reverse((c).begin(),(c).end()); #define vec(b) vector<int> (b); #define vecl(b) vector<long long> (b); #define vecs(b) vector<string> (b); #define vecsize(b,size) vector<int> (b)((size)); #define pb(b,a) (b).push_back((a)); #define doublece(a,b) cout<<(a)<<' '<<(b)<<endl; #define pairs(s) vector<pair<int,int>> (s); #define pairsl(s) vector<pair<ll,ll>> (s); #define pairss(s) vector<pair<string,string>> (s); #define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb)); #define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb)); #define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb)); #define pairsREV(s) (s).push_back(make_pair(bb,aa)); #define pairslREV(s) (s).push_back(make_pair(bb,aa)); #define pairssREV(s) (s).push_back(make_pair(bb,aa)); #define MOD 1000000007 int main() { ll N,A,B; cin >> N>>A>>B; vecl(H); fx(N) { vecpl(H); } A -= B; ll left = 0, right = 2000000000; ll mid; fx(50) { mid = (left + right) / 2; int k = mid; fy(N) { if (H[y] >mid*B) { ll tmp = (H[y] - mid * B); k -= (tmp + A - 1) / A; //at = mid- k; } } if (k>=0) { right = mid; } else { left = mid; } } right++; left++; ll k = left; fy(N) { if (H[y] > left* B) { ll tmp = (H[y] - left * B); k -= (tmp + A - 1) / A; } } //doublece(left,right) if (k>=0) { ce(left) } else { ce(right) } return 0; } ll k = left; fy(N) { if (H[y] > left* B) { ll tmp = (H[y] - left * B); k -= (tmp + A - 1) / A; } } //doublece(left,right) if (k>=0) { ce(left) } else { ce(right) } return 0; }
a.cc: In function 'int main()': a.cc:104:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 104 | int main() | ^~ a.cc:104:9: note: remove parentheses to default-initialize a variable 104 | int main() | ^~ | -- a.cc:104:9: note: or replace parentheses with braces to value-initialize a variable a.cc:105:1: error: a function-definition is not allowed here before '{' token 105 | { | ^
s765181868
p03700
C++
#include<iostream> #include<algorithm> #include<vector> #include<climits> using namespace std; int a,b; bool check(vector<int>vec,int target,int n); int main(){ int n; vector<int>vec; cin>>n; cin>>a>>b; for(int i;i<n;i++){ int data; cin>>data; vec.push_back(data); } sort(vec.begin(),vec.end()); int left=1; int right=INT_MAX-5; int target=(left+right)/2; while(left+1<right){ if(check(vec,target,n)==true){ right=target; }else{ left=target; } target=(left+right)/2; } cout<<right<<endl; return(0); } bool check(vector<int>vec,long long target,int n){ long long c=a-b; long long cnt=0; for(int i=0;i<n;i++){ if((long long)vec[i]-(long long)b*(long long)target>0){ cnt+=((long long)vec[i]-(long long)b*(long long)target+c-1)/(long long)c; } } if(cnt<=target){ return(true); } return(false); }
/usr/bin/ld: /tmp/ccZ6Ynoo.o: in function `main': a.cc:(.text+0xff): undefined reference to `check(std::vector<int, std::allocator<int> >, int, int)' collect2: error: ld returned 1 exit status
s644615465
p03700
C++
#include<iostream> #include<algorithm> #include<vector> #include<climits> using namespace std; int a,b; bool check(vector<int>vec,int target,int n); int main(){ int n; vector<int>vec; cin>>n; cin>>a>>b; for(int i;i<n;i++){ int data; cin>>data; vec.push_back(data); } sort(vec.begin(),vec.end()); int left=1; int right=INT_MAX-5; int target=(left+right)/2; while(left+1<right){ if(check(vec,target,n)==true){ right=target; }else{ left=target; } target=(left+right)/2; } cout<<right<<endl; return(0); } bool check(vector<int>vec,long long target,int n){ int c=a-b; long long cnt=0; for(int i=0;i<n;i++){ if((long long)vec[i]-(long long)b*(long long)target>0){ cnt+=((long long)vec[i]-(long long)b*(long long)target+c-1)/(long long)c; } } if(cnt<=target){ return(true); } return(false); }
/usr/bin/ld: /tmp/ccIepMPF.o: in function `main': a.cc:(.text+0xff): undefined reference to `check(std::vector<int, std::allocator<int> >, int, int)' collect2: error: ld returned 1 exit status
s657759739
p03700
C++
#include<iostream> #include<algorithm> #include<vector> #include<climits> using namespace std; long long int a,b; bool check(vector<long long>vec,int target,int n); int main(){ int n; vector<long long>vec; cin>>n; cin>>a>>b; for(int i;i<n;i++){ int data; cin>>data; vec.push_back(data); } sort(vec.begin(),vec.end()); int left=1; int right=INT_MAX-5; int target=(left+right)/2; while(left+1<right){ if(check(vec,target,n)==true){ right=target; }else{ left=target; } target=(left+right)/2; } cout<<right<<endl; return(0); } bool check(vector<long long>vec,long long target,int n){ long long c=a-b; long long cnt=0; for(int i=0;i<n;i++){ if(vec[i]-b*target>0){ cnt+=(vec[i]-b*target+c-1)/c; } } if(cnt<=target){ return(true); } return(false); }
/usr/bin/ld: /tmp/cc5vyBue.o: in function `main': a.cc:(.text+0x108): undefined reference to `check(std::vector<long long, std::allocator<long long> >, int, int)' collect2: error: ld returned 1 exit status
s484441427
p03700
C++
/* vrrtll==???>;::::~~~~~~......`.`````````````````````...-?777!_.._?7u,~~~::::;>>??=lllttrrzu rtll==??>>;::::~~~~......`.`````````````````` ..J77!`````````...`..._T,~~~~:::;;>??==lttrrv tll=??>>;:::~~~~......``````````````````..J7^ ` `` ` `` .,```````...._4,.~~~::;;>>?===lttr l=???>;;::~~~......`````HTSu,.`` `..J7! ` `` .J"~N```````````..?&.~~~~::;;>>?==llt =??>;;::~~~~.....``````.@????7SJ.?= ` ` `` .J=....J; ``````````..h..~~~~::;;>??=ll ?>>;::~~~~.....````````.D?>>?>?>?8+.`` `.J"_......_b` ````````.S_.~~~~::;;>??=l >;;::~~~~....``````````.C>??>>>?>>>?8J.` ```..Y~..........J; ` ` ``````` G...~~~~::;>??= ;;::~~~....```````` `..W1>>?>>>>?>>>>>?S,.`.7^.............-N`` ` ``````` 6...~~~~::;>?? ;:~~~~....``````` ..7` d??>>?>?>>?>>?>>1udMgggNNNNggJ.......([ `````.L...~~~~::;>? :~~~.....`````` .7` `K>?>?>>>>>>+ugNMMMB""7<!~~<?7TWMNNa,..w.` ` ` ` `````,)....~~:::;> ~~~....``````.J^ ` #>>?>>>?jgMMM9=_................-?TMMa,b` ` ` ` ````(,...~~~~:;; ~~~....``` .7`` ` @?>>?1uMM#=.........................(TMNa...... ` ``````4....~~~::; ~~~...`` .=`` ` ` .b>>jgNH".................`.............?HNmx??17TYY9SA+(..L....~~~:: ~....` ,^`` ` ` .b+dN#^............6..-(,-...`............(HMm+>>>>>?>>????zOM_.~~~:: .... .=``` `` ` ...JNMM^..........`..._n.(MMN,....`..`.........?MNe<>>?>??>????d^...~~~: ~...v```` ` ..-Z""!_..(M@_........`........?7MMMMp.................-TNN+?>>>????1d4-..-(Jk9 ..(^`...zY"!_........(MD..............`......JMMMMp....`..`..`......./MNx>??>>?1d!.h7=~(??= (v_`,R_.............(NF..(/..(&,...`..........?MMMM;..................(MMs>>?1&T"!``....(1= t..`` 4,...........(N@....?,(NMNR_.....`..`....(WMM$..`....`..`..`....._HMe7=```````....~_1 ...````.4,........-dM:.....(7MMMNR-.....................`............(.?^ `` ``````....~~~ ...``````,4,....`.(NF........(MMMMb..`....--................`....(.7! ` ````....~~: ..````` ` `.5J_...JMt.........?NMMM[...`.HH5._(J7[...`...`...--?^` ` `````....~~~: ...````` ` ` 7a,.dM{....`...../MMMN......(J=` .>......._(/= ` ` `````...~~~: ....```` `` (4MN{..........._7"^...(/^ `.C....-(J=` ` ` ```....~~~: ....````` ` JdM[...`...`........`_3.. ..?!..(-7! ` ` ``````....~~~:: r...`````` ` ``(CJMb..............`......__..-(?^ ` ` `````....~~::; J/...````` ` `,3>+MN-.`..`...`..........._(J=`` ` ` ```````....~~~::; _j,..`.```` ``.5>>?dNb...`......`......_-?'` ` `````....~~~::;; ~~j,..```````.D??>>>MM/....`........(-=` ` ` ` ```````...~~~:::;> ~~~j,...````.E??>??>?MN-.........(J= ` ` ` ``````....~~~~::;?? :~~~?,...``.@>?>?>>??dMN_....-(?^ ` ` ` ` ````````...~~~~:;;>?? ::~~~?/....K??????>>?>dMN-_(7! ` ` ` ````````....~~~:::>>??l ;:::~~/e.(K==?????????<dM"! ` ` ` ` `` ``````...~~~~:::;>??=l */ #include "bits/stdc++.h" using namespace std; #define ok1 printf("ok1\n") #define ok2 printf("ok2\n") #define M 1000000000000000000LL #define rep(i,n) for(int i=0;i<n;++i) #define REP(i,s,n) for(int i=(s);i<(n);++i) #define repr(i,n) for(int i=n-1;i>=0;--i) #define REPR(i,s,n) for(int i=(s);i>=(n);--(i)) #define all(a) (a).begin(),(a).end() #define reall(a) (a).rbegin(),(a).rend() #define pb emplace_back //emplace_backの方が速いが使い慣れてないため #define DOUBLE fixed << setprecision(15) #define fi first #define se second #define mp make_pair #define mt make_tuple #define BIT(n,m)(((n)>>(m))&1) const double pi = acos(-1.0); typedef vector<int> vi; typedef vector<string> vs; typedef long long ll; typedef vector<ll> vll; typedef vector<vi> vvi; typedef vector<vll> vvll; typedef vector<char> vc; typedef vector<double> vd; typedef vector<bool> vb; typedef deque<ll> dll; typedef pair<ll, ll> P; typedef vector<P> vP; const ll mod = 1e9 + 7; //const ll mod = 998244353; ll dy[4] = { 1,0,-1,0 }; ll dx[4] = { 0,1,0,-1 }; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template< typename T > struct edge { int src, to; T cost; edge(int to, T cost) : src(-1), to(to), cost(cost) {} edge(int src, int to, T cost) : src(src), to(to), cost(cost) {} edge &operator=(const int &x) { to = x; return *this; } operator int() const { return to; } }; template< typename T > using Edges = vector< edge< T > >; template< typename T > using WeightedGraph = vector< Edges< T > >; using UnWeightedGraph = vector< vector< int > >; template< typename T > using Matrix = vector< vector< T > >; bool out_check(ll a, ll b) { return (0 <= a && a < b); } void addmod(ll &a, ll &b) { a = (a + b) % mod; } void Pvi(vi v) { puts("vll------------------------------------------------"); rep(i, v.size()) cout << v[i] << " "; puts(""); puts("------------------------------------------------"); } void Pvll(vll v) { puts("vll------------------------------------------------"); rep(i, v.size()) cout << v[i] << " "; puts(""); puts("------------------------------------------------"); } void Pvvll(vvll v) { puts("vvll------------------------------------------------"); rep(i, v.size()) { rep(j, v[i].size()) cout << v[i][j] << " "; cout << endl; } puts("------------------------------------------------"); } void Pvs(vs s) { puts("vs------------------------------------------------"); rep(i, s.size()) { rep(j, s[i].size()) cout << s[i][j] << " "; cout << endl; } puts("------------------------------------------------"); } void Yes(bool x) { cout << ((x) ? "Yes\n" : "No\n"); } void YES(bool x) { cout << ((x) ? "YES\n" : "NO\n"); } void yes(bool x) { cout << ((x) ? "yes\n" : "no\n"); } void Yay(bool x) { cout << ((x) ? "Yay!\n" : ":(\n"); } ll n, m, d, e, r, l, k, h, ans, ret = M; bool flag = false, flag2 = false, flag3 = false; //string s, t, u; int main() { ios_base::sync_with_stdio(false); ll a, b; cin >> n >> a >> b; vll v(n); rep(i, n) cin >> v[i]; ll sa = a - b ng = 0, ok = 1000000000; while (ok - ng > 1) { ll mid = (ok + ng) / 2,cnt = 0; rep(i, n) { if (v[i] > b*mid) { cnt += (v[i] - b * mid - 1) / sa + 1; } } if (cnt > mid) ng = mid; else ok = mid; } cout << ok << endl; return 0; }
a.cc: In function 'int main()': a.cc:135:23: error: expected ',' or ';' before 'ng' 135 | ll sa = a - b ng = 0, ok = 1000000000; | ^~ a.cc:136:16: error: 'ok' was not declared in this scope; did you mean 'k'? 136 | while (ok - ng > 1) { | ^~ | k a.cc:136:21: error: 'ng' was not declared in this scope; did you mean 'n'? 136 | while (ok - ng > 1) { | ^~ | n a.cc:140:33: error: 'cnt' was not declared in this scope; did you mean 'int'? 140 | cnt += (v[i] - b * mid - 1) / sa + 1; | ^~~ | int a.cc:143:21: error: 'cnt' was not declared in this scope; did you mean 'int'? 143 | if (cnt > mid) ng = mid; | ^~~ | int a.cc:146:17: error: 'ok' was not declared in this scope; did you mean 'k'? 146 | cout << ok << endl; | ^~ | k
s241860987
p03700
Java
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; import java.util.*; public class Main { static int N; static int A; static int B; static int[] h; public static boolean isOK(int index) { long[] h_2 = new long[N]; for (int i=0;i<N;i++) { h_2[i] = h[i]; h_2[i] -= (long)B*index; } for (int i=0;i<N;i++) { if (h_2[i]>0) { index -= (h_2[i]+(A-B-1))/(A-B); } } if (index>=0) return true; else return false; } public static long binary_search() { long left = -1; long right = Integer.MAX_VALUE-100; while (right - left > 1) { long mid = left + (right - left) / 2; if (isOK(mid)) right = mid; else left = mid; } return right; } public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); N = in.nextInt(); A = in.nextInt(); B = in.nextInt(); h = new int[N]; for (int i=0;i<N;i++) { h[i] = in.nextInt(); } out.println(binary_search()); out.close(); } static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null; } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } } }
Main.java:39: error: incompatible types: possible lossy conversion from long to int if (isOK(mid)) right = mid; ^ Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 1 error
s400910424
p03700
C++
#include <bits/stdc++.h> #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++) #define S .second using ll=long long; using namespace std; ll h[110000]; int main(){ ll n,a,b,c,sum=0,tmp,ans=1e10; cin>>n>>a>>b; rep(i,0,n){cin>>h[i];sum+=h[i];} c=a-b; sort(h,h+n); ll l=0,r=h[n-1]; while(l<r){ tmp=ceil((ld)l+r)/2; if(sum<=tmp*b*n+tmp*c){ ans=min(ans,tmp); r=tmp-1; } else l=tmp+1; } cout<<ans; }
a.cc: In function 'int main()': a.cc:15:17: error: 'ld' was not declared in this scope; did you mean 'l'? 15 | tmp=ceil((ld)l+r)/2; | ^~ | l
s695873400
p03700
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF 1LL<<62 #define inf 1000000007 ll h[100010]; int main() { ll n,a,b; cin>>n>>a>>b; for(ll i=0;i<n;i++){ cin>>h[i]; } ll left=1,right=10000,00000,00001; while (right - left > 1) { ll mid = left + (right - left) / 2; // 区間の真ん中 bool ch=false; ll x=0; for(ll i=0;i<n;i++){ x+=max(ll(0),(h[i]-mid*b+(a-b)-1)/(a-b)); } if(mid>=x){ ch=true; } //cout << mid <<endl; /* 回答の応じて、年齢を絞る */ if (ch!=true) left = mid; // mid 歳以上なら、mid 歳以上 right 歳以下になるように else right = mid; // mid 歳未満なら、left 歳以上 mid 歳未満になるように } cout <<right; // your code goes here return 0; }
a.cc: In function 'int main()': a.cc:14:31: error: expected unqualified-id before numeric constant 14 | ll left=1,right=10000,00000,00001; | ^~~~~
s149126052
p03700
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.lang.Character.Subset; import java.math.BigDecimal; import java.text.DecimalFormat; import java.time.temporal.ValueRange; import java.util.AbstractMap; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Objects; import java.util.PriorityQueue; import java.util.Queue; import java.util.Set; import java.util.Stack; import java.util.TreeMap; import java.util.TreeSet; import java.util.concurrent.ForkJoinPool; import static java.util.Comparator.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; MyInput in = new MyInput(inputStream); PrintWriter out = new PrintWriter(outputStream); Solver solver = new Solver(in, out); solver.solve(); out.close(); } // ====================================================================== static class Solver { MyInput in; PrintWriter out; public Solver(MyInput in, PrintWriter out) { this.in = in; this.out = out; } // ----------------------------------------- int N; int A, B, max; long[] H; // index が条件を満たすかどうか boolean isOK(int index) { int cnt = 0; for (int i = 0; i < N; i++) { if(H[i] > (long)B * index) { cnt += (H[i] - B * index + A - B - 1) / (A - B); } if(cnt > index) return false; } return true; } // 汎用的な二分探索のテンプレ int binary_search() { int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1 int ok = max + 1; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size() /* ok と ng のどちらが大きいかわからないことを考慮 */ while (Math.abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if (isOK(mid)) ok = mid; // 条件を満たしたなら 下半分へ else ng = mid; // 満たさなければ 上半分へ } return ok; // 返すのは isOK() が true でセットする方( ok / ng ) } public void solve() { N = ni(); A = ni(); B = ni(); H = new int[N]; max = 0; for (int i = 0; i < N; i++) { H[i] = ni(); max = Math.max(max, H[i]); } prn(binary_search()); } // ----------------------------------------- // Integer のキーに対して、Integer のカウントを管理する(カウントを足したり、引いたりする) // キーの最大、最小の取得、データの追加、削除も O(long(N)) で処理できる // static class MapCounter { private TreeMap<Integer, Integer> map; // 昇順のマップ public MapCounter() { map = new TreeMap<>(); } // reverse = tree なら降順のマップ public MapCounter(boolean reverse) { if(reverse) { map = new TreeMap<Integer, Integer>(Collections.reverseOrder()); } else { map = new TreeMap<>(); } } // キーを追加する(キーが存在すれば、カウントに1足す) public void add(Integer key) { add(key, 1); } public void add(Integer key, int cnt) { Integer val = map.get(key); if(val == null) { map.put(key, cnt); } else { map.put(key, val + cnt); } } // キーを消す(キーが存在すれば、カウントを1減らす) public void remove(Integer key) { sub(key, 1, false); } // キーのカウントを減らす public void sub(Integer key) { sub(key, 1); } // キーのカウントから値を引く(マイナスのカウントを許す) public void sub(Integer key, int cnt) { sub(key, cnt, true); } // キーのカウントから値を引く //  → マイナスを許可しない場合で、カウントがマイナスになったら消す public void sub(Integer key, int cnt, boolean minus) { Integer val = map.get(key); if(val == null) { if(minus) { map.put(key, -cnt); // カウントのマイナスを許す } } else if(val > cnt || minus){ map.put(key, val - cnt); } else { map.remove(key); } } // キーのカウントを取得する(なければ NULLを返す) public Integer getCountwithNull(Integer key) { return map.get(key); } // キーのカウントを取得する(なければ 0 を返す) public Integer getCount(Integer key) { Integer val = map.get(key); if(val == null) return 0; else return val; } public Set<Integer> getKey() { return map.keySet(); } // 登録されているキーの数を返す public int getKeyCount() { return map.keySet().size(); } // 先頭キーを返す public Integer getFirstKey() { return map.firstKey(); } // 最終キーを返す public Integer getLastKey() { return map.lastKey(); } // マップの初期化 public void clear() { map.clear(); } } // ----------------------------------------- // 配列のバイナリーサーチ 1 boolean isRightMin(int[] a, boolean f, int index, int key) { if (f && a[index] >= key) return true; // 以上 else if (!f && a[index] > key) return true; // より大きい else return false; } // 配列 a の中で key 以上(f=true)または、より大きく(f=false)、一番小さい値を返す int binarySearchRightMin(int[] a, boolean f, int key) { int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1 int ok = (int)a.length; // 「index = a.length-1」が条件を満たさないこともあるので、初期値は a.length() /* ok と ng のどちらが大きいかわからないことを考慮 */ while (Math.abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if (isRightMin(a, f, mid, key)) ok = mid; // 下半分を対象とする else ng = mid; // 上半分を対象とする } return ok; // ← ここで返すのは isOK() が true の時にセットする方(ok / ng) } // ----------------------------------------- // 配列のバイナリーサーチ 2 boolean isLeftMax(int[] a, boolean f, int index, int key) { if (f && a[index] <= key) return true; // 以下 else if (!f && a[index] < key) return true; // より小さい else return false; } // 配列 a の中で key 以下(f=true)または、より小さい(f=false)、一番大きい値を返す int binarySearchLeftMax(int[] a, boolean f, int key) { int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1 int ok = (int)a.length; // 「index = a.length-1」が条件を満たさないこともあるので、初期値は a.length() /* ok と ng のどちらが大きいかわからないことを考慮 */ while (Math.abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if (isLeftMax(a, f, mid, key)) ng = mid; // 上半分を対象とする else ok = mid; // 下半分を対象とする } return ng; // ← ここで返すのは isOK() が true の時にセットする方(ok / ng) } // ----------------------------------------- // オイラーツアー(部分木対応)   →  工事中 static class EulerTour { Graph g; List<Integer> euler_tour = new ArrayList<>(); int[] begin, end; int k = 0, root = 0; void dfs(int v,int p, PrintWriter out) { out.println("v = " + v + " p = " + p); begin[v] = k; euler_tour.add(v); k++; if(!g.contains(v)) { return; } for(int i : g.get(v)) { if(i != p) { dfs(i, v, out); euler_tour.add(v); k++; } } end[v]=k; } // 初期化 public void init(int p_cnt, int root, Graph g, PrintWriter out) { begin = new int[p_cnt + 1]; end = new int[p_cnt + 1]; this.root = root; this.g = g; dfs(root, -1, out); } // 部分木の頂点を渡すと、オイラーツアーの部分木を返す public List getPartTour(int v) { return euler_tour.subList(begin[v], end[v]); } // 部分木の頂点を渡すと、頂点のリストを返す public List<Integer> getPartList(int v) { Set<Integer> set = new TreeSet<>(); set.addAll(getPartTour(v)); List<Integer> ans = new ArrayList<>(); for(Integer p : set) { ans.add(p); } return ans; } } // ----------------------------------------- // 重みなし グラフのリンクリスト static class Graph { // 頂点に紐づく頂点のリスト private Map<Integer, List<Integer>> data = new HashMap<Integer, List<Integer>>(); // // 全ての頂点のセット // private Set<Integer> point = new TreeSet<>(); // 頂点と頂点の繋がりを追加する void add(int from, int to) { List<Integer> list = data.get(from); if(list == null) { list = new ArrayList<Integer>(); data.put(from, list); } list.add(to); // point.add(key); // point.add(value); } // 指定された頂点に紐づく、頂点のリストを返す List<Integer> get(int key) { return data.get(key); } // 頂点 key が登録されているか? boolean contains(int key) { return data.containsKey(key); } // 頂点のセットを返す Set<Integer> keySet() { return data.keySet(); } // 頂点 key_1 と 頂点 key_2 がつながっていれば true を返す boolean isConnect(int key_1, int key_2) { List<Integer> list = data.get(key_1); if(list == null) return false; else return list.contains(key_2); } // 指定された頂点から、すべての頂点への距離を返す(重みなし) List<PP> distList(int key) { List<PP> dist = new ArrayList<>(); // 頂点と距離のペアのリスト Set<Integer> mark = new HashSet<>(); // 処理したら入れる Stack<PP> stack = new Stack<>(); // スタックの宣言 stack.push(new PP(key, 0)); // スタートをスタックに保存 while(!stack.isEmpty()) { PP wk = stack.pop(); // スタックから次の頂点を取得 int pp = wk.getKey(); int dd = wk.getVal(); mark.add(pp); // 通過マーク dist.add(new PP(pp, dd)); // 距離を登録 List<Integer> list = get(pp); // つながっている頂点のリストを取得 for(int next : list) { if(mark.contains(next)) continue; stack.push(new PP(next, dd + 1)); } } return dist; } // ダンプ void dump(PrintWriter out) { for(int key : data.keySet()) { out.print(key + " : "); for(int val : data.get(key)) { out.print(val + " "); } out.println(""); } } } // ----------------------------------------- // 重さを持ったグラフのリンクリスト static class GraphWith { // キーに紐づくリストに、頂点番号と重さのペアを持つ private Map<Integer, List<PP>> data = new HashMap<Integer, List<PP>>(); // 指定された頂点に紐づく、頂点と重さのペアを追加する void add(int key, PP p) { List<PP> list = data.get(key); if(list == null) { list = new ArrayList<PP>(); data.put(key, list); } list.add(p); } // 頂点に紐づく、頂点と重さのペアのリストを返す List<PP> get(int key) { return data.get(key); } // 頂点 key が登録されているか? boolean contains(int key) { return data.containsKey(key); } // 頂点のセットを返す Set<Integer> keySet() { return data.keySet(); } // 頂点 key_1 と 頂点 key_2 がつながっていれば true を返す boolean isConnect(int key_1, int key_2) { List<PP> list = data.get(key_1); if(list == null) return false; boolean ans = false; for(PP p : list) { if(p.getKey() == key_2) { ans = true; break; } } return ans; } } // ----------------------------------------- // 重みなし グラフのリンクリスト(Long) static class GraphLong { private Map<Long, List<Long>> G = new HashMap<Long, List<Long>>(); void add(long key, long value) { List<Long> list = G.get(key); if(list == null) { list = new ArrayList<Long>(); G.put(key, list); } list.add(value); } List<Long> get(long key) { return G.get(key); } } // ----------------------------------------- // 重さを持ったグラフのリンクリスト(Long) static class GraphLongWith { private Map<Long, List<PPL>> G = new HashMap<Long, List<PPL>>(); void add(long key, PPL p) { List<PPL> list = G.get(key); if(list == null) { list = new ArrayList<PPL>(); G.put(key, list); } list.add(p); } List<PPL> get(long key) { return G.get(key); } } // ----------------------------------------- void prn(String s) { out.println(s); } void prn(int i) { out.println(i); } void prn(long i) { out.println(i); } void prr(String s) { out.print(s); } int ni() { return in.nextInt(); } long nl() { return in.nextLong(); } double nd() { return in.nextDouble(); } String ns() { return in.nextString(); } int[] ndi(int n) { int[] ans = new int[n]; for(int i=0; i < n; i++) { ans[i] = ni(); } return ans; } long[] ndl(int n) { long[] ans = new long[n]; for(int i=0; i < n; i++) { ans[i] = nl(); } return ans; } double[] ndd(int n) { double[] ans = new double[n]; for(int i=0; i < n; i++) { ans[i] = nd(); } return ans; } String[] nds(int n) { String[] ans = new String[n]; for(int i=0; i < n; i++) { ans[i] = ns(); } return ans; } int[][] nddi(int n, int m) { int[][] ans = new int[n][m]; for(int i=0; i < n; i++) { for(int j=0; j < m; j++) { ans[i][j] = ni(); } } return ans; } long[][] nddl(int n, int m) { long[][] ans = new long[n][m]; for(int i=0; i < n; i++) { for(int j=0; j < m; j++) { ans[i][j] = nl(); } } return ans; } } // Set に入れるなら PPKEY を使う! static class PP{ public int key, val; public PP(int key, int val) { this.key = key; this.val = val; } public int getKey() { return key; } public void setKey(int key) { this.key = key; } public int getVal() { return val; } public void setVal(int val) { this.val = val; } } static class PPL { public long key, val; public PPL(long key, long val) { this.key = key; this.val = val; } public long getKey() { return key; } public void setKey(long key) { this.key = key; } public long getVal() { return val; } public void setVal(long val) { this.val = val; } } static class PPDL { public long key; public long[] val; public PPDL(long key, long[] val) { this.key = key; this.val = val; } public long getKey() { return key; } public void setKey(long key) { this.key = key; } public long[] getVal() { return val; } public void setVal(long[] val) { this.val = val; } public void dump(PrintWriter out) { out.print("key = " + key + " val "); for(int i=0; i < val.length; i++) { out.print("[" + val[i] + "] "); } out.println(""); } } // HashMap のキーに使う → Set に入れるのもこれ(PPでは値での比較が行われない) static final class PPKEY{ private final int key, val; public PPKEY(int key, int val) { this.key = key; this.val = val; } public int getKey() { return key; } public int getVal() { return val; } @Override public boolean equals(Object obj) { if (obj instanceof PPKEY) { PPKEY dest = (PPKEY) obj; return this.key == dest.key && this.val == dest.val; } else { return false; } } @Override public int hashCode() { return Objects.hash(key, val); } } // HashMap のキーに使う → Set に入れるのもこれ(PPでは値での比較が行われない) static final class PPLKEY{ private final long key, val; public PPLKEY(long key, long val) { this.key = key; this.val = val; } public long getKey() { return key; } public long getVal() { return val; } @Override public boolean equals(Object obj) { if (obj instanceof PPKEY) { PPKEY dest = (PPKEY) obj; return this.key == dest.key && this.val == dest.val; } else { return false; } } @Override public int hashCode() { return Objects.hash(key, val); } } // ====================================================================== static class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> { /** serialVersionUID. */ private static final long serialVersionUID = 6411527075103472113L; public Pair(final K key, final V value) { super(key, value); } } static class MyInput { private final BufferedReader in; private static int pos; private static int readLen; private static final char[] buffer = new char[1024 * 8]; private static char[] str = new char[500 * 8 * 2]; private static boolean[] isDigit = new boolean[256]; private static boolean[] isSpace = new boolean[256]; private static boolean[] isLineSep = new boolean[256]; static { for (int i = 0; i < 10; i++) { isDigit['0' + i] = true; } isDigit['-'] = true; isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true; isLineSep['\r'] = isLineSep['\n'] = true; } public MyInput(InputStream is) { in = new BufferedReader(new InputStreamReader(is)); } public int read() { if (pos >= readLen) { pos = 0; try { readLen = in.read(buffer); } catch (IOException e) { throw new RuntimeException(); } if (readLen <= 0) { throw new MyInput.EndOfFileRuntimeException(); } } return buffer[pos++]; } public int nextInt() { int len = 0; str[len++] = nextChar(); len = reads(len, isSpace); int i = 0; int ret = 0; if (str[0] == '-') { i = 1; } for (; i < len; i++) ret = ret * 10 + str[i] - '0'; if (str[0] == '-') { ret = -ret; } return ret; } public long nextLong() { int len = 0; str[len++] = nextChar(); len = reads(len, isSpace); int i = 0; long ret = 0L; if (str[0] == '-') { i = 1; } for (; i < len; i++) ret = ret * 10 + str[i] - '0'; if (str[0] == '-') { ret = -ret; } return ret; } public double nextDouble() { int len = 0; str[len++] = nextChar(); len = reads(len, isSpace); int i = 0; double ret = 0; if (str[0] == '-') { i = 1; } int cnt = 0; for (; i < len; i++) { if(str[i] == '.') { cnt = 10; continue; } if(cnt == 0) { ret = ret * 10 + str[i] - '0'; } else { ret = ret + ((double)(str[i] - '0') / cnt); cnt *= 10; } } if (str[0] == '-') { ret = -ret; } return ret; } public String nextString() { String ret = new String(nextDChar()).trim(); return ret; } public char[] nextDChar() { int len = 0; len = reads(len, isSpace); char[] ret = new char[len + 1]; for (int i=0; i < len; i++) ret[i] = str[i]; ret[len] = 0x00; return ret; } public char nextChar() { while (true) { final int c = read(); if (!isSpace[c]) { return (char) c; } } } int reads(int len, boolean[] accept) { try { while (true) { final int c = read(); if (accept[c]) { break; } if (str.length == len) { char[] rep = new char[str.length * 3 / 2]; System.arraycopy(str, 0, rep, 0, str.length); str = rep; } str[len++] = (char) c; } } catch (MyInput.EndOfFileRuntimeException e) { } return len; } static class EndOfFileRuntimeException extends RuntimeException { } } }
Main.java:89: error: incompatible types: int[] cannot be converted to long[] H = new int[N]; ^ Main.java:93: error: incompatible types: possible lossy conversion from long to int max = Math.max(max, H[i]); ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors
s444859105
p03700
C++
#include<bits/stdc++.h> using namespace std; int main{ int N,A,B; cin>>N>>A>>B; vector<long long> h(N); for(int i=0;i<N;++i)cin>>h[i]; long long l=0,r=1LL<<48; while(l+1!=r){ long long c=(l+r)/2,need=0; for(int i=0;i<N;++i)need+=max(0LL,h[i]-B*c+A-B-1)/(A-B); if(need<=c) r=c; else l=c; } cout<<r<<endl; return 0; }
a.cc:5:5: error: cannot declare '::main' to be a global variable 5 | int main{ | ^~~~ a.cc:6:3: error: expected primary-expression before 'int' 6 | int N,A,B; | ^~~ a.cc:6:3: error: expected '}' before 'int' a.cc:5:9: note: to match this '{' 5 | int main{ | ^ a.cc:7:3: error: 'cin' does not name a type 7 | cin>>N>>A>>B; | ^~~ a.cc:8:23: error: 'N' was not declared in this scope 8 | vector<long long> h(N); | ^ a.cc:9:3: error: expected unqualified-id before 'for' 9 | for(int i=0;i<N;++i)cin>>h[i]; | ^~~ a.cc:9:15: error: 'i' does not name a type 9 | for(int i=0;i<N;++i)cin>>h[i]; | ^ a.cc:9:19: error: expected unqualified-id before '++' token 9 | for(int i=0;i<N;++i)cin>>h[i]; | ^~ a.cc:11:3: error: expected unqualified-id before 'while' 11 | while(l+1!=r){ | ^~~~~ a.cc:19:3: error: 'cout' does not name a type 19 | cout<<r<<endl; | ^~~~ a.cc:20:3: error: expected unqualified-id before 'return' 20 | return 0; | ^~~~~~ a.cc:21:1: error: expected declaration before '}' token 21 | } | ^
s828315057
p03700
C++
#include <iostream> #include <cstdlib> #include <algorithm> #include <vector> #include <string> #include <map> #include <tuple> #include <math.h> #include <deque> #include <stack> using namespace std; typedef long long ll; bool enough(vector<ll> h, ll a, ll b, ll t){ ll dif = a - b; ll need = 0; for(ll i = 0;i < h.size(); i++){ need += max(0, ((h[i] - b * t) / dif))); } if(need <= t){ return true; }else{ return false; } } int solve() { ll n, a, b; cin >> n >> a >> b; vector<ll> h(n); for(ll i = 0;i < n;i++){ cin >> h[i]; } ll mx = 1000000000; ll mn = 0; ll mid = -1; while(mx >= mn) { mid = mn + (mx - mn) / 2; if(enough(h, a, b, mid)){ mx = mid - 1; } else { mn = mid + 1; } } cout << mid + 1 << endl; return 0; } int main(void){ solve(); return 0; }
a.cc: In function 'bool enough(std::vector<long long int>, ll, ll, ll)': a.cc:20:16: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 20 | need += max(0, ((h[i] - b * t) / dif))); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:20:16: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 20 | need += max(0, ((h[i] - b * t) / dif))); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:3: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:20:16: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 20 | need += max(0, ((h[i] - b * t) / dif))); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
s113105942
p03700
C++
#include <iostream> #include <cstdlib> #include <algorithm> #include <vector> #include <string> #include <map> #include <tuple> #include <math.h> #include <deque> #include <stack> using namespace std; typedef long long ll; bool enough(vector<ll> h, ll a, ll b, ll t){ ll dif = a - b; ll need = 0; for(ll i = 0;i < h.size(); i++){ need += max(0, ((h[i] - b * t) / dif)); } if(need <= t){ return true; }else{ return false; } } int solve() { ll n, a, b; cin >> n >> a >> b; vector<ll> h(n); for(ll i = 0;i < n;i++){ cin >> h[i]; } ll mx = 1000000000; ll mn = 0; ll mid = -1; while(mx >= mn) { mid = mn + (mx - mn) / 2; if(enough(h, a, b, mid)){ mx = mid - 1; } else { mn = mid + 1; } } cout << mid + 1 << endl; return 0; } int main(void){ solve(); return 0; }
a.cc: In function 'bool enough(std::vector<long long int>, ll, ll, ll)': a.cc:20:16: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 20 | need += max(0, ((h[i] - b * t) / dif)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:20:16: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 20 | need += max(0, ((h[i] - b * t) / dif)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:3: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:20:16: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 20 | need += max(0, ((h[i] - b * t) / dif)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
s558344241
p03700
C++
#include <bits/stdc++.h> using namespace std; #define MP make_pair #define PB push_back #define F first #define S second #define FOR(i, a, b) for(int i = a; i <= (b); i++) #define all(x) x.begin(), x.end() typedef pair<int, int> pi; typedef long long ll; const int INF = 2000000000; vector<int> health; int N, A, B; bool valid(int exp) { vector<int> tmp(health); FOR(i, 0, N - 1) health[i] -= exp * B; int necessary = 0; FOR(i, 0, N - 1) { necessary += max(0, ceil(tmp[i] / (A - B))); } return necessary <= exp; } int main() { cin >> N >> A >> B; health.resize(N); FOR(i, 0, N - 1) cin >> health[i]; int x = -1; for (int b = 1e9; b >= 1; b /= 2) { while (!valid(x + b)) x += b; } int ans = x + 1; cout << ans; return 0; }
a.cc: In function 'bool valid(int)': a.cc:28:21: error: no matching function for call to 'max(int, __gnu_cxx::__enable_if<true, double>::__type)' 28 | necessary += max(0, ceil(tmp[i] / (A - B))); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:28:21: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'}) 28 | necessary += max(0, ceil(tmp[i] / (A - B))); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:28:21: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 28 | necessary += max(0, ceil(tmp[i] / (A - B))); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
s593112246
p03700
C++
#include <bits/stdc++.h> #define REP(i, n) for(ll i = 0; i < (ll)n; i++) #define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++) #define ALL(obj) (obj).begin(), (obj).end() #define INF (1ll << 60) using namespace std; typedef long long ll; typedef double db; typedef string str; typedef pair<ll, ll> p; constexpr int MOD = 1000000007; using ll = long long; template <class T> inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } void print(const std::vector<ll> &v) { std::for_each(v.begin(), v.end(), [](ll x) { std::cout << x << " "; }); std::cout << std::endl; } int N, A, B; vector<ll> h; bool isOK(ll t) { int cnt = 0; REP(i, N) { if(h[i] - B * t > 0) { cnt += (h[i] - B * t + A - B - 1) / (A - B); } } if(cnt <= t) { return false; } return true; } // 汎用的な二分探索のテンプレ int binary_search(vector<ll> t) { ll ng = -1LL; //「index = 0」が条件を満たすこともあるので、初期値は -1 ll ok = INF; /* ok と ng のどちらが大きいかわからないことを考慮 */ while(abs(ok - ng) > 1LL) { ll mid = (ok + ng) / 2LL; if(isOK(mid, t)) ok = mid; else ng = mid; } return ok; } int main() { cin >> N >> A >> B; // A > B vector<ll> h; h.resize(N); REP(i, N) { cin >> h[i]; } cout << binary_search(h) << endl; return 0; }
a.cc: In function 'int binary_search(std::vector<long long int>)': a.cc:57:16: error: too many arguments to function 'bool isOK(ll)' 57 | if(isOK(mid, t)) | ~~~~^~~~~~~~ a.cc:35:6: note: declared here 35 | bool isOK(ll t) { | ^~~~
s212932525
p03700
C++
#include<iostream> #include<climits> #include<vector> using namespace std; bool enough(vector<int> &h, int t, int a, int b){ int need = 0; for(auto hi: h){ if(hi > b * t) { need += (hi - b * t + (a - b - 1)) / (a - b); } } if(need <= t) return true; else return false; return true; } int bin(vector<int> &h, int min, int max, int a, int b){ int mid = (min + max) / 2; if (mid == min) return max; if(enough(h, mid, a, b)) return bin(h, min, mid, a, b); else return bin(h, mid, max, a, b); } int main(){ int n, a, b, h_tmp; int h_max = INT_MIN; int h_max_index; int h_max_index_tmp; int count = 0; cin >> n >> a >> b; vector<int> h(n); for(int i = 0; i < n; i++){ cin >> h_tmp; h[i] = h_tmp; } cout << bin(h, t / a - 1, (t + b - 1)/ b, a, b); return 0; }
a.cc: In function 'int main()': a.cc:39:24: error: 't' was not declared in this scope 39 | cout << bin(h, t / a - 1, (t + b - 1)/ b, a, b); | ^
s226247236
p03700
C++
#include<iostream> #include<climits> #include<vector> using namespace std; int main(){ int n, a, b, h_tmp; int vector<int> h; int h_max = INT_MIN; int h_max_index; int count = 0; cin >> n >> a >> b; for(int i = 0; i < n; i++){ cin >> h_tmp; h[i] = h_tmp; if(h_tmp > h_max) { h_max = h_tmp; h_max_index = i; } } while(h_max > 0){ count++; h_max = INT_MIN; for(int i = 0; i < n; i++) { if(i == h_max_index) { h[i] -= a; } else { h[i] -= b; } if(h[i] > h_max) { h_max = h[i]; h_max_index = i; } } } cout << count; return 0; }
a.cc: In function 'int main()': a.cc:8:25: error: invalid declarator before 'h' 8 | int vector<int> h; | ^ a.cc:15:17: error: 'h' was not declared in this scope 15 | h[i] = h_tmp; | ^ a.cc:26:33: error: 'h' was not declared in this scope 26 | h[i] -= a; | ^ a.cc:28:33: error: 'h' was not declared in this scope 28 | h[i] -= b; | ^ a.cc:30:28: error: 'h' was not declared in this scope 30 | if(h[i] > h_max) { | ^
s432352213
p03700
C++
#include <cassert> #include <cstdio> #include <cmath> #include <iostream> #include <sstream> #include <string> #include <vector> #include <map> #include <queue> #include <algorithm> using namespace std; using lint = long long; constexpr int MOD = 1000000007, INF = 1111111111; template <class T> ostream &operator<<(ostream &os, const vector<T> &vec) { for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " "); return os; } template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << p.first << " " << p.second; return os; } template <class T1, class T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp) { for (const auto &e : mp) os << "[" << e << "] "; return os; } #ifdef _DEBUG template <class Head> void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; }; template <class Head, class... Tail> void dump(const char* str, Head &&h, Tail &&... t) { while (*str != ',') cerr << *str++; cerr << " = " << h << "\n"; dump(str + (*(str + 1) == ' ' ? 2 : 1), t...); } #define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__) #else #define DMP(...) ((void)0) #endif int main() { cin.tie(nullptr); ios::sync_with_stdio(false); lint N, A, B; cin >> N >> A >> B; vector<lint> h(N); for (int i = 0; i < N; i++) cin >> h[i]; sort(h.begin(), h.end()); auto biSearch = [&](auto &f) { lint ng = -1; lint ok = h.back(); while (abs(ok - ng) > 1) { lint mid = (ok + ng) / 2; if (f(mid)) ok = mid; else ng = mid; } return ok; }; auto judge = [&](int &idx) { lint ex = 0; for (int i = 0; i < N; i++) { if (h[i] - B * idx > 0) ex += (h[i] - B * idx - 1) / (A - B) + 1; DMP(ex); } DMP(idx, ex); return ex <= idx; }; cout << biSearch(judge) << "\n"; return 0; }
a.cc: In instantiation of 'main()::<lambda(auto:1&)> [with auto:1 = main()::<lambda(int&)>]': a.cc:86:18: required from here 86 | cout << biSearch(judge) << "\n"; | ~~~~~~~~^~~~~~~ a.cc:66:30: error: no match for call to '(main()::<lambda(int&)>) (lint&)' 66 | if (f(mid)) ok = mid; | ~^~~~~ a.cc:73:22: note: candidate: 'main()::<lambda(int&)>' (near match) 73 | auto judge = [&](int &idx) { | ^ a.cc:73:22: note: conversion of argument 1 would be ill-formed: a.cc:66:31: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'lint' {aka 'long long int'} 66 | if (f(mid)) ok = mid; | ^~~
s865932767
p03700
C++
#include<iostream> #include<string> #include<cstdio> #include <cstring> #include<vector> #include<cmath> #include<algorithm> #include<functional> #include<iomanip> #include<queue> #include<ciso646> #include<random> #include<map> #include<set> #include<complex> #include<bitset> #include<stack> #include<unordered_map> #include<utility> using namespace std; typedef long long ll; typedef unsigned int ui; const ll mod = 1000000007; typedef long double ld; const ll INF = 1e+14; typedef pair<int, int> P; #define stop char nyaa;cin>>nyaa; #define rep(i,n) for(int i=0;i<n;i++) #define per(i,n) for(int i=n-1;i>=0;i--) #define Rep(i,sta,n) for(int i=sta;i<n;i++) #define rep1(i,n) for(int i=1;i<=n;i++) #define per1(i,n) for(int i=n;i>=1;i--) #define Rep1(i,sta,n) for(int i=sta;i<=n;i++) typedef complex<ld> Point; const ld eps = 1e-8; const ld pi = acos(-1.0); typedef pair<ld, ld> LDP; typedef pair<ll, ll> LP; #define fr first #define sc second #define all(c) c.begin(),c.end() #define pb push_back void Yes(){ cout<<"Yes"<<endl; exit(0); } void No(){ cout<<"No"<<endl; exit(0); } int main() { ios::sync_with_stdio(false); cin.tie(0); int N, A, B; cin >> N >> A >> B; A -= B; //魔物を倒す順は関係ない priority_queue<int> pque; rep(i, N) { int h; cin >> h; pque.push(h); } int a = que.top(); que.pop(); int b = que.top(); que.pop(); int cnt = 1; while(a > A + B * cnt || b > B * cnt) { cnt ++; a -= A; que.push(a); que.push(b); a = que.top(); que.pop(); b = que.top(); que.pop(); } cout << cnt - 1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:65:13: error: 'que' was not declared in this scope; did you mean 'pque'? 65 | int a = que.top(); que.pop(); | ^~~ | pque
s338816940
p03700
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i) #define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i) #define per(i,N) for(int i=(N)-1;i>=0;--i) #define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i) #define all(arr) (arr).begin(), (arr).end() #define SP << " " << #define SPF << " " #define SPEEDUP cin.tie(0);ios::sync_with_stdio(false); #define MAX_I INT_MAX //1e9 #define MIN_I INT_MIN //-1e9 #define MAX_UI UINT_MAX //1e9 #define MAX_LL LLONG_MAX //1e18 #define MIN_LL LLONG_MIN //-1e18 #define MAX_ULL ULLONG_MAX //1e19 typedef long long ll; typedef pair<int,int> PII; typedef pair<char,char> PCC; typedef pair<ll,ll> PLL; typedef pair<char,int> PCI; typedef pair<int,char> PIC; typedef pair<ll,int> PLI; typedef pair<int,ll> PIL; typedef pair<ll,char> PLC; typedef pair<char,ll> PCL; inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;} inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;} inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;} int N,A,B; vector<int> v; bool sat(ll m){ int C = A-B; vector<ll> w(N); rep(i,N) w[i] = v[i] - m*B; rep(i,N){ if(w[i]<0)continue; m -= w[i]/C; if(w[i]%C != 0)--m; } return m>=0; } int main(void){ SPEEDUP cout << setprecision(15); cin >> N >> A >> B; v = vector<ll>(N); rep(i,N)cin >> v[i]; sort(all(v),greater<ll>()); ll l = 0, r = v[N-1]; while(r-l>1){ ll m = (r+l)/2; if(sat(m)) r = m; else l = m; } cout << r << endl; return 0; }
a.cc: In function 'int main()': a.cc:49:19: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'std::vector<long long int>') 49 | v = vector<ll>(N); | ^ In file included from /usr/include/c++/14/vector:72, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' 210 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'const std::vector<int>&' 211 | operator=(const vector<_Tp, _Alloc>& __x) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66: /usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]' 766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<int>&&' 766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]' 788 | operator=(initializer_list<value_type> __l) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::initializer_list<int>' 788 | operator=(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
s872888595
p03700
C++
#include <iostream> #include <set> #include <map> #include <vector> #include <algorithm> #include <iomanip> #include <climits> #include <numeric> #include <cmath> #include <queue> #include <sstream> #include <string.h> #include <bitset> using namespace std; typedef long long ll; vector<ll> list; ll N, A, B; bool isOK(ll x) { ll num = 0; for (int i = 0; i < N; i++) { ll hp = list[i] - (x * B); if (hp > 0) { ll cnt = hp / (A - B); if (hp % (A - B)) { cnt++; } } num += cnt; } return x >= num; } ll binary_search() { ll left = -1; ll right = 1e9 + 10; while (right - left > 1) { ll mid = left + (right - left) / 2; if (isOK(mid)) right = mid; else left = mid; } return right; } int main() { cin >> N >> A >> B; list.resize(N); for (int i = 0; i < N; i++) { cin >> list[i]; } cout << binary_search() << endl; return 0; }
a.cc: In function 'bool isOK(ll)': a.cc:31:12: error: 'cnt' was not declared in this scope; did you mean 'int'? 31 | num += cnt; | ^~~ | int
s051858631
p03700
C++
int n ,a ,b ,h ,cnt ; priority_queue<int> pq ; int main(){ scanf("%d%d%d",&n,&a,&b) ; a -= b ; while(n--){ scanf("%d",&h); pq.push(h); } while(pq.top() - 1ll*b*cnt>0){ pq.push(pq.top()-a); pq.pop(); ++cnt ; } printf("%d",cnt); return 0 ; }
a.cc:2:1: error: 'priority_queue' does not name a type 2 | priority_queue<int> pq ; | ^~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:4:5: error: 'scanf' was not declared in this scope 4 | scanf("%d%d%d",&n,&a,&b) ; | ^~~~~ a.cc:8:9: error: 'pq' was not declared in this scope 8 | pq.push(h); | ^~ a.cc:10:11: error: 'pq' was not declared in this scope 10 | while(pq.top() - 1ll*b*cnt>0){ | ^~ a.cc:15:5: error: 'printf' was not declared in this scope 15 | printf("%d",cnt); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | int n ,a ,b ,h ,cnt ;
s494524287
p03700
C++
#include<iostream> #include<algorithm> using namespace std; typedef long long ll; int MAX=100010; ll N,A,B; ll h[MAX]; bool enough(ll x){ ll num=0; for(int i=0;i<N;i++){ num+=(h[i]-B*x+(A-B-1))/(A-B); } if(num<=x) return true; else return false; } int main(){ cin >> N >> A >> B; ll mx=0; for(int i=0;i<N;i++){ cin >> h[i]; mx=max(mx,h[i]); } ll left=0; ll right=mx+1; while(right-left>0){ ll mid=(left+right)/2; if(enough(mid)){ right=mid; }else{ left=mid+1; } } cout << right << endl; }
a.cc:8:6: error: size of array 'h' is not an integral constant-expression 8 | ll h[MAX]; | ^~~
s152795342
p03700
C++
#include<iostream> #include<algorithm> using namespace std; typedef long long ll; ll MAX=100010; ll N,A,B; ll h[MAX]; bool enough(ll x){ ll num=0; for(int i=0;i<N;i++){ num+=(h[i]-B*x+(A-B-1))/(A-B); } if(num<=x) return true; else return false; } int main(){ cin >> N >> A >> B; ll mx=0; for(int i=0;i<N;i++){ cin >> h[i]; mx=max(mx,h[i]); } ll left=0; ll right=mx+1; while(right-left>0){ ll mid=(left+right)/2; if(enough(mid)){ right=mid; }else{ left=mid+1; } } cout << right << endl; }
a.cc:8:6: error: size of array 'h' is not an integral constant-expression 8 | ll h[MAX]; | ^~~
s314676678
p03700
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,b,a; cin >> n >> a >> b; int x = 0; vector<int> h(n); for(int i=0;i<n;i++){ cin >> h.at(i); } sort(a.begin(), a.end()); while(a.at(n-1) > 0){ for(int i=0;i<n-1;i++){ a.at(i) -= b; } a.at(n-1) -= a; sort(a.begin(), a.end()); x++; } cout << x << endl; }
a.cc: In function 'int main()': a.cc:12:10: error: request for member 'begin' in 'a', which is of non-class type 'int' 12 | sort(a.begin(), a.end()); | ^~~~~ a.cc:12:21: error: request for member 'end' in 'a', which is of non-class type 'int' 12 | sort(a.begin(), a.end()); | ^~~ a.cc:14:11: error: request for member 'at' in 'a', which is of non-class type 'int' 14 | while(a.at(n-1) > 0){ | ^~ a.cc:16:9: error: request for member 'at' in 'a', which is of non-class type 'int' 16 | a.at(i) -= b; | ^~ a.cc:18:7: error: request for member 'at' in 'a', which is of non-class type 'int' 18 | a.at(n-1) -= a; | ^~ a.cc:19:12: error: request for member 'begin' in 'a', which is of non-class type 'int' 19 | sort(a.begin(), a.end()); | ^~~~~ a.cc:19:23: error: request for member 'end' in 'a', which is of non-class type 'int' 19 | sort(a.begin(), a.end()); | ^~~
s726857364
p03700
C++
#pragma GCC optimize ("O3") #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <queue> #include <set> #include <algorithm> #include <numeric> #include <list> using namespace std; using QWORD = uint64_t; using SQWORD = int64_t; using DWORD = uint32_t; using SDWORD = int32_t; using WORD = uint16_t; using SWORD = int16_t; using BYTE = uint8_t; using SBYTE = int8_t; using DOUBLE = double; using FLOAT = float; #define MIN_SDWORD (-2147483648) #define MAX_SDWORD (2147483647) #define MIN_SBYTE (-128) #define MAX_SBYTE (127) #define MIN_SQWORD (0x8000000000000000) #define MAX_SQWORD (0x7FFFFFFFFFFFFFFF) #define MAX_QWORD (0xFFFFFFFFFFFFFFFF) #define MAX_DWORD (0xFFFFFFFF) #define MAX_WORD (0xFFFF) #define MAX_BYTE (0xFF) #define ArrayLength(a) (sizeof(a) / sizeof(a[0])) static inline QWORD MAX(QWORD a, QWORD b) { return a > b ? a : b; } static inline DWORD MAX(DWORD a, DWORD b) { return a > b ? a : b; } static inline SDWORD MAX(SDWORD a, SDWORD b) { return a > b ? a : b; } static inline QWORD MIN(QWORD a, QWORD b) { return a < b ? a : b; } static inline DWORD MIN(DWORD a, DWORD b) { return a < b ? a : b; } static inline SDWORD MIN(SDWORD a, SDWORD b) { return a < b ? a : b; } static inline SDWORD DIV_UP_N(SDWORD a, SDWORD b) {return (a + b-1) / b;} static inline SQWORD DIV_UP_N(SQWORD a, SQWORD b) {return (a + b-1) / b;} #define BYTE_BITS (8) #define WORD_BITS (16) #define DWORD_BITS (32) #define QWORD_BITS (64) using M_BOOL = bool; #define M_TRUE (true) #define M_FALSE (false) #define DIVISOR (1000000007) static inline void inputString(char *pcStr) { char *pcCur = pcStr; for (;;) { char c = getchar(); if (('\n' == c) || (EOF == c)) { break; } *pcCur = c; pcCur++; } *pcCur = '\0'; } static inline SQWORD inputSQWORD(void) { SQWORD sqNumber = 0; SQWORD sqMultiplier = 1; M_BOOL bRead = M_FALSE; for (;;) { char c = getchar(); if (!bRead) { if ('-' == c) { sqMultiplier = -1; } } if (('0' <= c) && (c <= '9')) { sqNumber *= 10LL; sqNumber += (SQWORD)(c - '0'); bRead = M_TRUE; } else { if (bRead) { return sqNumber * sqMultiplier; } } } } static inline SDWORD inputSDWORD(void) { SDWORD lNumber = 0; SDWORD lMultiplier = 1; M_BOOL bRead = M_FALSE; for (;;) { char c = getchar(); if (!bRead) { if ('-' == c) { lMultiplier = -1; } } if (('0' <= c) && (c <= '9')) { lNumber *= 10; lNumber += (c - '0'); bRead = M_TRUE; } else { if (bRead) { return lNumber * lMultiplier; } } } } static inline DOUBLE inputFP(void) { DOUBLE dInt = 0.0; DOUBLE dFrac = 0.0; DOUBLE dMultiplier = 1.0; DWORD dwFpCnt = 0; DOUBLE *pdCur = &dInt; M_BOOL bRead = M_FALSE; for (;;) { char c = getchar(); if (!bRead) { if ('-' == c) { dMultiplier = -1; } } if ('.' == c) { pdCur = &dFrac; } else if (('0' <= c) && (c <= '9')) { (*pdCur) *= 10; (*pdCur) += (DOUBLE)(c - '0'); bRead = M_TRUE; if (pdCur == &dFrac) { dwFpCnt++; } } else { if (bRead) { return dMultiplier * (dInt + dFrac / (pow((DOUBLE)10.0 , (DOUBLE)dwFpCnt))); } } } } /** * mod による操作ライブラリ */ #define ANS_MOD (1000000007LL) static SQWORD addMod(SQWORD x, SQWORD y) { return (x + y) % ANS_MOD; } static SQWORD subMod(SQWORD x, SQWORD y) { return (x - y + ANS_MOD) % ANS_MOD; } static SQWORD mulMod(SQWORD x, SQWORD y) { return (x * y) % ANS_MOD; } static SQWORD powMod(SQWORD x, SQWORD e) { SQWORD v = 1; for (; e; x = mulMod(x, x), e >>= 1) { if (e & 1) { v = mulMod(v, x); } } return v; } static SQWORD divMod(SQWORD x, SQWORD y) { return mulMod(x, powMod(y, ANS_MOD - 2)); } static SQWORD combMod(SQWORD n, SQWORD k) { SQWORD v=1; for(SQWORD i=1; i<=k; i++) { v = divMod(mulMod(v, n-i+1),i); } return v; } /*----------------------------------------------*/ static bool isAllDestroyed( SQWORD sqCnt, SQWORD sqInput_A, SQWORD sqInput_B, const vector<SQWORD> &vecsqInput_h) { SQWORD sqBase = sqInput_B * sqCnt; SQWORD sqNeedAttackCnt = 0; for (auto target: vecsqInput_h) { SQWORD sqRest = max(0LL, target - sqBase); sqNeedAttackCnt += DIV_UP_N(sqRest, sqInput_A - sqInput_B); } if (sqNeedAttackCnt <= sqCnt) { return true; } else { return false; } } /** * 2分探索 */ static SQWORD binarySearch( bool (*judge)(SQWORD, SQWORD, SQWORD, const vector<SQWORD>&), SQWORD sqInitLb, SQWORD sqInitUb, SQWORD sqInput_A, SQWORD sqInput_B, const vector<SQWORD> &vecsqInput_h) { SQWORD sqLb = sqInitLb; SQWORD sqUb = sqInitUb; while (1LL < sqUb - sqLb) { SQWORD sqMid = (sqUb + sqLb) / 2LL; if (judge(sqMid, sqInput_A, sqInput_B, vecsqInput_h)) { sqUb = sqMid; } else { sqLb = sqMid; } } return sqUb; } int main(void) { SQWORD sqInput_N = inputSQWORD(); SQWORD sqInput_A = inputSQWORD(); SQWORD sqInput_B = inputSQWORD(); vector<SQWORD> vecsqInput_h; for (SQWORD sqIdx = 0; sqIdx < sqInput_N; sqIdx++) { SQWORD sqInput_h = inputSQWORD(); vecsqInput_h.emplace_back(sqInput_h); } sort(vecsqInput_h.begin(), vecsqInput_h.end(), greater<SQWORD>()); SQWORD sqAns = binarySearch(isAllDestroyed, 0, MAX_SDWORD, sqInput_A, sqInput_B, vecsqInput_h); printf("%lld\n", sqAns); return 0; }
a.cc:19:16: error: 'uint64_t' does not name a type 19 | using QWORD = uint64_t; | ^~~~~~~~ a.cc:17:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 16 | #include <list> +++ |+#include <cstdint> 17 | using namespace std; a.cc:21:16: error: 'uint32_t' does not name a type 21 | using DWORD = uint32_t; | ^~~~~~~~ a.cc:21:16: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:23:16: error: 'uint16_t' does not name a type 23 | using WORD = uint16_t; | ^~~~~~~~ a.cc:23:16: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:25:16: error: 'uint8_t' does not name a type 25 | using BYTE = uint8_t; | ^~~~~~~ a.cc:25:16: note: 'uint8_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:46:15: error: 'QWORD' does not name a type; did you mean 'SWORD'? 46 | static inline QWORD MAX(QWORD a, QWORD b) { return a > b ? a : b; } | ^~~~~ | SWORD a.cc:47:15: error: 'DWORD' does not name a type; did you mean 'SWORD'? 47 | static inline DWORD MAX(DWORD a, DWORD b) { return a > b ? a : b; } | ^~~~~ | SWORD a.cc:49:15: error: 'QWORD' does not name a type; did you mean 'SWORD'? 49 | static inline QWORD MIN(QWORD a, QWORD b) { return a < b ? a : b; } | ^~~~~ | SWORD a.cc:50:15: error: 'DWORD' does not name a type; did you mean 'SWORD'? 50 | static inline DWORD MIN(DWORD a, DWORD b) { return a < b ? a : b; } | ^~~~~ | SWORD a.cc: In function 'DOUBLE inputFP()': a.cc:135:5: error: 'DWORD' was not declared in this scope; did you mean 'SWORD'? 135 | DWORD dwFpCnt = 0; | ^~~~~ | SWORD a.cc:152:17: error: 'dwFpCnt' was not declared in this scope 152 | dwFpCnt++; | ^~~~~~~ a.cc:156:82: error: 'dwFpCnt' was not declared in this scope 156 | return dMultiplier * (dInt + dFrac / (pow((DOUBLE)10.0 , (DOUBLE)dwFpCnt))); | ^~~~~~~ a.cc: In function 'bool isAllDestroyed(SQWORD, SQWORD, SQWORD, const std::vector<long int>&)': a.cc:220:28: error: no matching function for call to 'max(long long int, long int)' 220 | SQWORD sqRest = max(0LL, target - sqBase); | ~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:3: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:220:28: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int') 220 | SQWORD sqRest = max(0LL, target - sqBase); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:14: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:220:28: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 220 | SQWORD sqRest = max(0LL, target - sqBase); | ~~~^~~~~~~~~~~~~~~~~~~~~~
s975790549
p03700
C++
#include<bits/stdc++.h> using namespace std; int binary_search(vector<int> &h, long long x){ int ok = (int)h.size(); int ng = - 1; while (abs(ok - ng) > 1){ int mid = (ok + ng) / 2; if (h[mid] > x) ok = mid; else ng = mid; } return ok; } int main(){ long long n, a, b; cin >> n >> a >> b; vector<long long> h(n); for (int i = 0; i < n; i++) cin >> h[i]; sort(h.begin(), h.end()); long long ok = 1'000'000'001; long long ng = - 1; while (abs(ok - ng) > 1){ long long mid = (ok + ng) / 2; long long tmp = binary_search(h, mid * b); long long res = 0; for (int i = tmp; i < n; i++){ res += (h[i] - mid * b + a - b - 1)/(a - b); } if (res <= mid) ok = mid; else ng = mid; } cout << ok << endl; }
a.cc: In function 'int main()': a.cc:25:38: error: no matching function for call to 'binary_search(std::vector<long long int>&, long long int)' 25 | long long tmp = binary_search(h, mid * b); | ~~~~~~~~~~~~~^~~~~~~~~~~~ a.cc:4:5: note: candidate: 'int binary_search(std::vector<int>&, long long int)' 4 | int binary_search(vector<int> &h, long long x){ | ^~~~~~~~~~~~~ a.cc:4:32: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<int>&' 4 | int binary_search(vector<int> &h, long long x){ | ~~~~~~~~~~~~~^ In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate: 'template<class _FIter, class _Tp> bool std::binary_search(_FIter, _FIter, const _Tp&)' 2194 | binary_search(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> bool std::binary_search(_FIter, _FIter, const _Tp&, _Compare)' 2228 | binary_search(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate expects 4 arguments, 2 provided
s149197060
p03700
C++
#include<bits/stdc++.h> #define ll long long #define pii pair<int,int> #define mp make_pair #define rep(i,n) for(int i=0;i<(int)(n);i++) #define all(c) c.begin(),c.end() #define pb push_back #define fi first #define se second #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) using namespace std; int n,a,b; ll mon[100001]; bool check(int mid){ ll nowans=0; for(int i=0;i<n;i++) nowans+=max(0,(mon[i]-b*mid+a-1)/a); if(nowans<=mid) return 1; return 0; } int main(){ cin>>n>>a>>b; a-=b; for(int i=0;i<n;i++) scanf("%d",&mon[i]); ll lb=-1,ub=1.5e9; while(lb<=ub){ ll mid=(lb+ub)/2; if(check(mid)) ub=mid-1; else lb=mid+1; } cout<<lb<<endl; return 0; }
a.cc: In function 'bool check(int)': a.cc:18:20: error: no matching function for call to 'max(int, long long int)' 18 | nowans+=max(0,(mon[i]-b*mid+a-1)/a); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:18:20: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 18 | nowans+=max(0,(mon[i]-b*mid+a-1)/a); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:18:20: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 18 | nowans+=max(0,(mon[i]-b*mid+a-1)/a); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~
s062980813
p03700
C++
#include "/Users/daikikodama/Desktop/stdc++.h" //#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<(n); i++) #define int long long #define double long double #define mod 1000000007 #define F first #define S second #define P pair<long long,long long> #define all(a) a.begin(),a.end() #define INF 1000000000000000000 #define endl '\n' template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; signed main(void){ int n,a,b; cin>>n>>a>>b; vector<int> h(n); rep(i,n)cin>>h.at(i); int R=1000000000,L=0; while(R-L>1){ int M=(R+L)/2; int cnt=0; rep(i,n){ int tmp=h.at(i)-M*b; if(tmp<=0)continue; cnt+=(tmp+a-b-1)/(a-b); } if(cnt>M){ L=M; }else{ R=M; } } cout<<R<<endl; }
a.cc:1:10: fatal error: /Users/daikikodama/Desktop/stdc++.h: No such file or directory 1 | #include "/Users/daikikodama/Desktop/stdc++.h" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s743498891
p03700
C++
#include "/Users/daikikodama/Desktop/stdc++.h" //#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<(n); i++) #define int long long #define double long double #define mod 1000000007 #define F first #define S second #define P pair<long long,long long> #define all(a) a.begin(),a.end() #define INF 1000000000000000000 #define endl '\n' template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; signed main(void){ int n,a,b; cin>>n>>a>>b; vector<int> h(n); rep(i,n)cin>>h.at(i); int R=INF,L=0; while(R-L>1){ int M=(R+L)/2; int cnt=0; rep(i,n){ int tmp=max<int>(0,h.at(i)-M*b); cnt+=(tmp+a-b-1)/(a-b); } if(cnt>M){ L=M; }else{ R=M; } } cout<<R<<endl; }
a.cc:1:10: fatal error: /Users/daikikodama/Desktop/stdc++.h: No such file or directory 1 | #include "/Users/daikikodama/Desktop/stdc++.h" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s690536070
p03700
C++
#include<bits/stdc++.h> using namespace std; long n,a,b,h[100000],i,l=1,m,r=1e9,x; main(){ for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; while(l<r){ m=(l+r)/2; for(x=i=0;i<n;++i)h[i]>(long)m*b?x+=(h[i]-m*b+a-1)/a:0; x<=m?r=m:l=m+1; } cout<<l; }
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:5:19: error: expected ';' before ')' token 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^ | ; a.cc:5:37: warning: capture of variable 'h' with non-automatic storage duration 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^ a.cc:3:12: note: 'long int h [100000]' declared here 3 | long n,a,b,h[100000],i,l=1,m,r=1e9,x; | ^ a.cc:5:38: error: expected ',' before '+' token 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^ | , a.cc:5:38: error: expected identifier before '+' token a.cc: In lambda function: a.cc:5:43: error: expected '{' before ';' token 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^ a.cc: In function 'int main()': a.cc:5:34: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'main()::<lambda()>') 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ~~~^~~~~~~~~ | | | | | main()::<lambda()> | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:5:36: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'void (*)()' 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^~~~~~~ a.cc:5:36: note: after user-defined conversion: 'constexpr main()::<lambda()>::operator void (*)()() const' 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:5:36: error: invalid user-defined conversion from 'main()::<lambda()>' to 'short int&' [-fpermissive] 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^~~~~~~ a.cc:5:36: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^ a.cc:5:36: note: no known conversion from 'void (*)()' to 'short int' a.cc:5:36: error: invalid conversion from 'void (*)()' to 'short int' [-fpermissive] 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^~~~~~~ | | | void (*)() a.cc:5:36: error: conversion to non-const reference type 'short int&' from rvalue of type 'void (*)()' [-fpermissive] /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:5:36: error: invalid user-defined conversion from 'main()::<lambda()>' to 'short unsigned int&' [-fpermissive] 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^~~~~~~ a.cc:5:36: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^ a.cc:5:36: note: no known conversion from 'void (*)()' to 'short unsigned int' a.cc:5:36: error: invalid conversion from 'void (*)()' to 'short unsigned int' [-fpermissive] 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^~~~~~~ | | | void (*)() a.cc:5:36: error: conversion to non-const reference type 'short unsigned int&' from rvalue of type 'void (*)()' [-fpermissive] /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:5:36: error: invalid user-defined conversion from 'main()::<lambda()>' to 'int&' [-fpermissive] 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^~~~~~~ a.cc:5:36: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^ a.cc:5:36: note: no known conversion from 'void (*)()' to 'int' a.cc:5:36: error: invalid conversion from 'void (*)()' to 'int' [-fpermissive] 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^~~~~~~ | | | void (*)() a.cc:5:36: error: conversion to non-const reference type 'int&' from rvalue of type 'void (*)()' [-fpermissive] /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:5:36: error: invalid user-defined conversion from 'main()::<lambda()>' to 'unsigned int&' [-fpermissive] 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^~~~~~~ a.cc:5:36: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^ a.cc:5:36: note: no known conversion from 'void (*)()' to 'unsigned int' a.cc:5:36: error: invalid conversion from 'void (*)()' to 'unsigned int' [-fpermissive] 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^~~~~~~ | | | void (*)() a.cc:5:36: error: conversion to non-const reference type 'unsigned int&' from rvalue of type 'void (*)()' [-fpermissive] /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:5:36: error: invalid user-defined conversion from 'main()::<lambda()>' to 'long int&' [-fpermissive] 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^~~~~~~ a.cc:5:36: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^ a.cc:5:36: note: no known conversion from 'void (*)()' to 'long int' a.cc:5:36: error: invalid conversion from 'void (*)()' to 'long int' [-fpermissive] 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^~~~~~~ | | | void (*)() a.cc:5:36: error: conversion to non-const reference type 'long int&' from rvalue of type 'void (*)()' [-fpermissive] /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:5:36: error: invalid user-defined conversion from 'main()::<lambda()>' to 'long unsigned int&' [-fpermissive] 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^~~~~~~ a.cc:5:36: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^ a.cc:5:36: note: no known conversion from 'void (*)()' to 'long unsigned int' a.cc:5:36: error: invalid conversion from 'void (*)()' to 'long unsigned int' [-fpermissive] 5 | for(cin>>n>>a>>b),a-=b;i<n;)cin>>[h+i++]; | ^~~~~~~ |
s858069497
p03700
C++
#include <bits/stdc++.h> #define int long long #define MOD 1000000007 using namespace std; bool enough(int t,int n,int a,int b,int h[]){ int c = a-b; int sum=0; for(int i=0;i<n;i++){ h[i]=h[i]-b*t; if(h[i]>0){ int count = ceil((float)h[i]/c); sum = sum +count; } if(sum>t){ return false; } } if(sum<=t){ return true; } } signed main(){ int N,A,B; cin>> N >> A >> B; int h[N]; for(int i=0;i<N;i++){ cin >> h[i]; } int min = 1; int max = MOD; while(1){ int pos = (min+max)/2; if(max-min==1){ if(enough(min,N,A,B,h)){ cout <<min<<endl; return 0; } else{ cout << max <<endl; return 0; } } if(enough(pos,A,B,h)){ max = pos; } else{ min = pos; } } return 0; }
a.cc: In function 'int main()': a.cc:62:27: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive] 62 | if(enough(pos,A,B,h)){ | ^ | | | long long int* a.cc:62:18: error: too few arguments to function 'bool enough(long long int, long long int, long long int, long long int, long long int*)' 62 | if(enough(pos,A,B,h)){ | ~~~~~~^~~~~~~~~~~ a.cc:8:6: note: declared here 8 | bool enough(int t,int n,int a,int b,int h[]){ | ^~~~~~ a.cc: In function 'bool enough(long long int, long long int, long long int, long long int, long long int*)': a.cc:30:1: warning: control reaches end of non-void function [-Wreturn-type] 30 | } | ^
s572110497
p03700
C++
/* ``.-''!!!!!!!!!!!!!!!!!!!!!!!!!!!''-..` `.'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'.` `.'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'.` `.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.` `'!!!!!!!!!!!!!!!!!!(((*****((!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'` `'!!!!!!!!!!!+"u%$$####################$$%3""!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'` .!!!!!!!!!!!!!"#############$$$$$$$$$############$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!. `!!!!!!!!!!!!!!!!!"z%%3I"+(!!!!!!!!!!!!!!!!!!*"I3%%j(!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!` -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!- '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!(*"""""IjjjjIt""""*(!!!!!!!!!!!!!!!!!!!!' '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!(I%$$##$$%"!!!!!!!!!!!!!!!!!!!!!!!!!!!3$##########################$$3""!!!!!!!!!!!!!!' .!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"$############$(!!!!!!!!!!!!!!!!!!!!!!!($######$#########$3&%$$$##########$!!!!!!!!!!!!!!. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!t################(!!!!!!!!!!!!!!!!!!!!!!!!!!!!!I$###########%(!!!!!!("j%$%3*!!!!!!!!!!!!!!!! `!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!$################"!!!!!!!!!!!!!!!!!!!!!!!!!!!!$###############"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!` .!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!$##############%!!!!!!!!!!!!!!!!!!!!!!!!!!!!"################$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!. `!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"$##########%*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!$###############"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!` !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!+""""*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!I$###########%(!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"j3%%%z"*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!(+"""+*(!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!+""""""""""*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!""""""""""""*!!!!"$$#################$$$3j"+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"""""""""""""!!!u############################$$J"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!. '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"""""""""""""(!!!!!((!!!!!!!!!!!!!!(*""u%$########$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!""""""""""""""*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!+t%$%3+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' .!!!!!!!!!!!!!!!!!!!!!!!!!!!!!("""""""""""""""!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!(((*+""""""+(!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!. !!!!!!!!!!!!!!!!!!!!!!!!!(""""""""""""""""+!!!!!!!!!!!!!!!!!!!!(((*+"""""""""""""""""""""""!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .!!!!!!!!!!!!!!!!!!!(+"""""""""""""""""(!!!!!!!(((*+"""""""""""""""""""""""""""""""""""""(!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!. .!!!!!!!!!!!!!!("""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""+*(((!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!. .!!!!!!!!!!("""""""""""""""""""""""""""""""""""""""""""""""""+*(((!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!. `'!!!!!!"""""""""""""""""""""""""""""""""""""""""""""""""""(!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'` .!!!""""""""""""""""""""""""""""""""""""""""""""""""""""""!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!. ."""""""""""""""""""""""""""""""""""""""""""""""""""""!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'` !""""""""""""""""""""""""""""""""""""""""""""""""""(!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!. .""""""""""""""""""""""""""""""""""""""""""""""""""""!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'. .*""""""""""""""""""""""""""""""""""""""""""""""""""!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'. !""""""""""""""""""""""""""""""""""""""""""""""(!!!!!!!!!!!!!!!!!!!!!!!!!'-. !(""""""""""""""""""""""""""""""""""""""""""""!!!!!!!!!!!!!!!!''.`` `!!""""""""""""""""""""""""""""""""""""""""!..````` .!!!*"""""""""""""""""""""""""+(!!!!!. _ _ _ _ _ _ _ _ _ _ _ / /\ / /\ / /\ / /\ / /\ /\ \ /\_\/\_\ _ /\ \ /\ \ _ /\ \ / / \ / / \ / / \ / / / / / / \ \ \ / / / / //\_\ \ \ \ / \ \ /\_\ / \ \ / / /\ \__ / / /\ \ / / /\ \__ / /_/ / / / /\ \_\ /\ \/ \ \/ / / /\ \_\ / /\ \ \_/ / // /\ \_\ / / /\ \___\ / / /\ \ \ / / /\ \___\ / /\ \__/ / / / /\/_/ / \____\__/ / / /\/_/ / / /\ \___/ // / /\/_/ \ \ \ \/___// / / \ \ \ \ \ \ \/___// /\ \___\/ / / / / / /\/________/ / / / / / / \/____// / / ______ \ \ \ / / /___/ /\ \ \ \ \ / / /\/___/ / / / / / / /\/_// / / / / / / / / / / // / / /\_____\ _ \ \ \ / / /_____/ /\ \ _ \ \ \ / / / / / / / / / / / / / / / / / / / / / / / // / / \/____ / /_/\__/ / / / /_________/\ \ \ /_/\__/ / / / / / / / /___/ / /__ / / / / / /___/ / /__ / / / / / // / /_____/ / / \ \/___/ / / / /_ __\ \_\\ \/___/ / / / / / / //\__\/_/___\\/_/ / / //\__\/_/___\/ / / / / // / /______\/ / \_____\/ \_\___\ /____/_/ \_____\/ \/_/ \/_/ \/_________/ \/_/ \/_________/\/_/ \/_/ \/___________/ */ #include<bits/stdc++.h> using namespace std; #define ALL(obj) (obj).begin(), (obj).end() #define REP(i, n) for(int i = 0;i < (n);++i) #define endl '\n' #define pb emplace_back #define mkp make_pair #define p_q priority_queue #define INF 2000000000 #define PI 3.1415926 const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1}; const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1}; const long long MOD = 1e9+7; // typedef long long ll; #define int long long template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;} template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;} template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);} int n, a, b, h[100000]; bool enough(int t){ int hp[100000]; copy(h, h+100000, hp); REP(i, n) hp[i] -= b*t; int cnt = 0; REP(i, n){ if(hp[i] > 0) cnt += (hp[i]+a-1)/a; } if(cnt > t) return 0; else return 1; } signed main(void){ cin.tie(0); ios::sync_with_stdio(false); cin >> n >> a >> b; a-=b; REP(i, n) cin >> h[i]; int left = 0; right = 1000000000000000LL; while(right - left > 1){ int mid = (left+right) / 2; if(enough(mid)) right = mid; else left = mid; } cout << right << endl; return 0; }
a.cc: In function 'int main()': a.cc:102:23: error: assignment of function 'std::ios_base& std::right(ios_base&)' 102 | int left = 0; right = 1000000000000000LL; | ~~~~~~^~~~~~~~~~~~~~~~~~~~ a.cc:103:15: warning: pointer to a function used in arithmetic [-Wpointer-arith] 103 | while(right - left > 1){ | ~~~~~~^~~~~~ a.cc:103:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 103 | while(right - left > 1){ | ~~~~~~~~~~~~~^~~ a.cc:104:20: warning: pointer to a function used in arithmetic [-Wpointer-arith] 104 | int mid = (left+right) / 2; | ~~~~^~~~~~ a.cc:104:28: error: invalid operands of types 'std::ios_base& (*)(std::ios_base&)' and 'int' to binary 'operator/' 104 | int mid = (left+right) / 2; | ~~~~~~~~~~~~ ^ ~ | | | | | int | std::ios_base& (*)(std::ios_base&) a.cc:105:27: error: assignment of function 'std::ios_base& std::right(ios_base&)' 105 | if(enough(mid)) right = mid; | ~~~~~~^~~~~
s411158760
p03700
C++
#include <iostream> #include <vector> #include <algorithm> #include <utility> using namespace std; bool enough( long T, int A, int B, vector<int>& h ) { long long numNecessaryAtacks = 0; for( int i = 0; i < h.size(); ++i ) { numNecessaryAtacks += max( 0, (h[i] - B*T + (A-B-1)) / (A - B) ); } return numNecessaryAtacks <= T; } int main() { int N, A, B; cin >> N >> A >> B; vector<int> h(N); for( int i = 0; i < N; ++i ) cin >> h[i]; // 二分探索 int l = 0, r = 1e+9; while( r-l > 1 ) { int c = ( l + r ) / 2; if( enough(c, A, B, h) ) r = c; else l = c; } cout << r << endl; return 0; }
a.cc: In function 'bool enough(long int, int, int, std::vector<int>&)': a.cc:14:34: error: no matching function for call to 'max(int, long int)' 14 | numNecessaryAtacks += max( 0, (h[i] - B*T + (A-B-1)) / (A - B) ); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:14:34: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long int') 14 | numNecessaryAtacks += max( 0, (h[i] - B*T + (A-B-1)) / (A - B) ); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:3: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:14:34: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 14 | numNecessaryAtacks += max( 0, (h[i] - B*T + (A-B-1)) / (A - B) ); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s785458552
p03700
C++
#include <iostream> #include <cmath> #include <cfenv> using namespace std; #define ll long long int main () { ll n, a, b; cin >> n >> a >> b; ll h[n], sub[n]; ll max = 0; for (ll i = 0; i < n; i++) { cin >> h[i]; max += h[i] / b + 1; sub[i] = h[i]; } ll left = 0; ll right = max + 1; while (left < right - 1) { double check = (double) mid / 1000000000; if (check * b > 1) { right = mid; } ll mid = (left + right) / 2; for (ll i = 0; i < n; i++) { sub[i] = h[i] - b * mid; } ll num = 0; for (ll i = 0; i < n; i++) { if (sub[i] > 0) { num += ceil((float) sub[i] / (a - b)); } } if (mid >= num) { right = mid; } else { left = mid; } } cout << right << endl; }
a.cc: In function 'int main()': a.cc:20:29: error: 'mid' was not declared in this scope 20 | double check = (double) mid / 1000000000; | ^~~
s764666299
p03700
C++
#include <iostream> #include <math.h> #include <algorithm> #include <set> #include <map> #include <string> using namespace std; typedef long long ll; #define rep(i,s,n)for(ll i=s;i<n;i++) #define repe(i,s,n)for(ll i=s;i<=n;i++) #define rep_r(i,s,n)for(ll i=n-1;i>=s;i--) #define repe_r(i,s,n)for(ll i=s;i<=n;i++) static const ll MOD = 1e9 + 7; static const ll MAX_L = (ll)1 << 62; ll h[100001] = {}; ll k[100001] = {}; ll n, a, b; //bool holocost(ll t) { // rep(i, 0, n) k[i] = h[i] - b * t; // // ll cnt = 0; // rep(i, 0, n) { // if (h[i] > 0) { // cnt += k[i] / (a - b); // if (k[i] % (a - b) != 0)cnt++; // } // } // return cnt <= t; //} bool condition(ll x) { rep(i, 0, n) { k[i] = h[i]; } rep(i, 0, n) k[i] -= x * b; ll cnt = 0; rep(i, 0, n) { if (k[i] > 0) { ll d = a - b; cnt += k[i] / d; if (k[i] % d != 0)cnt++; } } return cnt <= x; } int main() { cin >> n >> a >> b; rep(i, 0, n) cin >> h[i]; ll l = -1; ll r = (ll)1 << 30; ll m; while (r - l > 1) { m = (l + r) / 2; if (holocost(m)) { r = m; } else { l = m; } } cout << r << endl; return 0; }
a.cc: In function 'int main()': a.cc:58:21: error: 'holocost' was not declared in this scope 58 | if (holocost(m)) { | ^~~~~~~~
s966744427
p03700
C++
\#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; ll n,a,b,h[100001],t; int main(void){ cin>>n>>a>>b; ll l=0, r=(ll)1e9,m,sub,tm; for(int i=0;i<n;i++){ cin>>t; h[i]=t; } while(r-l>1){ m=l+(r-l)/2; tm=m; for(int i=0;i<n;i++){ if(h[i]-tm*b<0)continue; sub=(h[i]-tm*b)/(a-b); if((h[i]-tm*b)%(a-b))m-=sub+1; else m-=sub; } if(m<0)l=tm; else r=tm; } cout<<r<<endl; return 0; }
a.cc:1:1: error: stray '\' in program 1 | \#include <iostream> | ^ a.cc:1:2: error: stray '#' in program 1 | \#include <iostream> | ^ a.cc:1:3: error: 'include' does not name a type 1 | \#include <iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/vector:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> |
s586069967
p03700
C++
#include<iostream> #include<cstdio> #include<string> #include<algorithm> #include<utility> #include<numeric> #include<vector> #include<map> #include<unordered_map> #include<set> #include<tuple> #include<stack> #include<queue> #include<functional> #include<iterator> #include<cmath> #include<cctype> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> P; const int INF = 1e9; const ll LINF = 1e18; const int MOD = INF+7; struct edge{int to,cost;}; void dump(ll *b,int n){ for(int i=0;i<n;i++){ cout << b[i] << " "; } cout << "\n"; } bool judge(){ } int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; ll a,b; cin >> n >> a >> b; a-=b; int h[n]; ll M=0; for(int i=0;i<n;i++){ cin >> h[i]; M=max(M,h[i]); } ll l=0,r=M,mid; int H; ll numc; bool ok; ll ans=(ll)1e15;; for(int i=0;i<100;i++){ ok=true; mid = (l+r)/2; numc=mid; for(int j=0;j<n;j++){ H=h[j]; H-=b*mid; if(H>0){ numc -= H/a; if(H%a!=0) numc--; } if(numc<0){ ok=false; break; } } if(ok){ ans=min(ans,mid); r=mid; }else l=mid; } cout << ans << "\n"; return 0; }
a.cc: In function 'bool judge()': a.cc:40:1: warning: no return statement in function returning non-void [-Wreturn-type] 40 | } | ^ a.cc: In function 'int main()': a.cc:55:22: error: no matching function for call to 'max(ll&, int&)' 55 | M=max(M,h[i]); | ~~~^~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:55:22: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 55 | M=max(M,h[i]); | ~~~^~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:4: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:55:22: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 55 | M=max(M,h[i]); | ~~~^~~~~~~~
s320051863
p03700
C++
#include <bits/stdc++.h> using namespace std; long long n, a, b; vector<long long> h; bool solve(long long total) { long long cnt_a = total; long long cnt_b = 0; for (long long i = 0; i < n; i++) { long long rest = h[i] - a * cnt_a - b * cnt_b; if (rest > 0) { return false; } long long cnt = - rest / (a - b); cnt_a = cnt; cnt_b = total - cnt_a; } return true; } long long main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> a >> b; h = vector<long long>(n); for (long long i = 0; i < n; i++) { cin >> h[i]; } sort(h.begin(), h.end(), greater<long long>()); long long ok = (h[0] + b - 1) / b; long long ng = (h[0] + a - 1) / a - 1; while (ok - ng > 1) { long long mid = (ok + ng) / 2; if (solve(mid)) { ok = mid; } else { ng = mid; } } cout << ok << endl; return 0; }
cc1plus: error: '::main' must return 'int'
s317380667
p03700
C++
#include <bits/stdc++.h> using namespace std; int N,i,j,k; int64_t A,B,sm,ans,mx=0; int64_t h[100010]; bool check(int64_t t){ sm = 0; for(i = 0;i < N;i++){ if(h[i] - B*t > 0){ sm += (h[i] - B*t + A - B - 1)/(A - B); } } if(sm <= t){ return false; }else{ return true; } } int64_t BinarySearch(int64_t low, int64_t high, function< bool(int64_t) > check){ while(1){ if(high-low == 1){ return high; break; } ll mid = low+(high-low)/2; if(check(mid)){ low = mid; }else{ high = mid; } } } int main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); // ifstream in("input.txt"); // cin.rdbuf(in.rdbuf()); cin >> N >> A >> B; for(i = 0;i < N;i++){ cin >> h[i]; mx = max(mx, h[i]); } ans = BinarySearch(0LL, mx+1, check); cout << ans << endl; return 0; }
a.cc: In function 'int64_t BinarySearch(int64_t, int64_t, std::function<bool(long int)>)': a.cc:27:5: error: 'll' was not declared in this scope 27 | ll mid = low+(high-low)/2; | ^~ a.cc:28:14: error: 'mid' was not declared in this scope 28 | if(check(mid)){ | ^~~
s177287921
p03700
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; scanf("%d",&N); int a,b; int score = 0; int scoresum = 0; scanf("%d%d",&a,&b); vector <int> hp(N); for(int i = 0;i<N;i++){ scanf("&d",&hp.at(i)); } sort(hp.begin(),hp.end()); reverse(hp.begin,hp.end()); for(int i = 0;i<N;i++){ score = 0; if(hp[i]>0){ if(hp[i]%a == 0){ score += hp[i]/a; } else{ score += (hp[i]/a)+1; } for(int k = i+1;k<N;k++){ if(hp[k]>0){ hp[k] - score*b; } } } scoresum += score; } cout << scoresum << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:10: error: no matching function for call to 'reverse(<unresolved overloaded function type>, std::vector<int>::iterator)' 15 | reverse(hp.begin,hp.end()); | ~~~~~~~^~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'void std::reverse(_BIter, _BIter) [with _BIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]' 1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last) | ^~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1083:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' 1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last) | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ In file included from /usr/include/c++/14/algorithm:86: /usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)' 249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last); | ^~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
s280455255
p03700
C++
#include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<algorithm> #include<vector> #include<limits> #include<numeric> #include<type_traits> #include<math.h> using namespace std; #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define in(x) cin >> x #define out(str) cout << str << endl template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } int N,A,B,maxi=0,add,sum,low,high,mid; bool check(int T,int temp[N],int add); int main(){ cin>>N>>A>>B; int h[N]; rep(i,N){ cin>>h[i]; maxi=max(maxi,h[i]); } maxi=(maxi/B)+1; add=A-B; low=0; high=maxi; while(low<=high){ mid=(low+high)/2; if(check(mid,h,add)){ if(check(mid-1,h,add)){ high=mid-1; } else{ out(mid); return 0; } } else{ if(check(mid+1,h,add)){ out(mid); return 0; } else{ low=mid+1; } } } return 0; } bool check(int T,int temp[],int add){ sum=0; rep(j,N){ temp[j]-=T*B; if(temp[j]>0){ sum+=temp[j]/add; if(temp[j]%add!=0)sum+=1; } } if(sum>T){ return false; }else{ return true; } }
a.cc:22:27: error: size of array 'temp' is not an integral constant-expression 22 | bool check(int T,int temp[N],int add); | ^
s710787283
p03700
C++
#include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<algorithm> #include<vector> #include<limits> #include<numeric> #include<type_traits> #include<math.h> using namespace std; #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define in(x) cin >> x #define out(str) cout << str << endl template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } int N,A,B,maxi=0,add,sum,low,high,mid; bool check(int T,int temp[N],int add); int main(){ cin>>N>>A>>B; int h[N]; rep(i,N){ cin>>h[i]; maxi=max(maxi,h[i]); } maxi=(maxi/B)+1; add=A-B; low=0; high=maxi; while(low<=high){ mid=(low+high)/2; if(check(mid,h,add)){ if(check(mid-1,h,add)){ high=mid-1; } else{ out(mid); return 0; } } else{ if(check(mid+1,h,add)){ out(mid); return 0; } else{ low=mid+1; } } } return 0; } bool check(int T,int temp[N],int add){ sum=0; rep(j,N){ temp[j]-=T*B; if(temp[j]>0){ sum+=temp[j]/add; if(temp[j]%add!=0)sum+=1; } } if(sum>T){ return false; }else{ return true; } }
a.cc:22:27: error: size of array 'temp' is not an integral constant-expression 22 | bool check(int T,int temp[N],int add); | ^ a.cc:59:27: error: size of array 'temp' is not an integral constant-expression 59 | bool check(int T,int temp[N],int add){ | ^
s920570951
p03700
C++
#include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<algorithm> #include<vector> #include<limits> #include<numeric> #include<type_traits> #include<math.h> using namespace std; #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define in(x) cin >> x #define out(str) cout << str << endl template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } int N,A,B,maxi=0,add,sum,low,high,mid; bool check(int T,int temp[N],int add){ sum=0; rep(j,N){ temp[j]-=T*B; if(temp[j]>0){ sum+=temp[j]/add; if(temp[j]%add!=0)sum+=1; } } if(sum>T){ return false; }else{ return true; } } int main(){ cin>>N>>A>>B; int h[N]; rep(i,N){ cin>>h[i]; maxi=max(maxi,h[i]); } maxi=(maxi/B)+1; add=A-B; low=0; high=maxi; while(low<=high){ mid=(low+high)/2; if(check(mid,h,add)){ if(check(mid-1,h,add)){ high=mid-1; } else{ out(mid); return 0; } } else{ if(check(mid+1,h,add)){ out(mid); return 0; } else{ low=mid+1; } } } return 0; }
a.cc:22:27: error: size of array 'temp' is not an integral constant-expression 22 | bool check(int T,int temp[N],int add){ | ^
s566670769
p03700
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); TaskX solver = new TaskX(); solver.solve(1, in, out); out.close(); } static int INF = 1 << 30; static long LINF = 1L << 55; static int MOD = 1000000007; static int[] mh4 = { 0, -1, 1, 0 }; static int[] mw4 = { -1, 0, 0, 1 }; static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 }; static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 }; static class TaskD { int n; long a, b; public void solve(int testNumber, InputReader in, PrintWriter out) { n = in.nextInt(); a = in.nextLong(); b = in.nextLong(); long[] h = in.nextLongArray(n); int l = 0, r = INF; while (r - l > 1) { int m = (r+l)/2; if (check(m, h)) { r = m; } else { l = m; } } out.println(r); } boolean check(int m ,long[] h) { int count = 0; for (int i = 0; i < n; i++) { count += Math.max((h[i] - b*m + (a - b -1)) / (a - b), 0); } return count <= m; } } static class InputReader { BufferedReader in; StringTokenizer tok; public String nextString() { while (!tok.hasMoreTokens()) { try { tok = new StringTokenizer(in.readLine(), " "); } catch (IOException e) { throw new InputMismatchException(); } } return tok.nextToken(); } public int nextInt() { return Integer.parseInt(nextString()); } public long nextLong() { return Long.parseLong(nextString()); } public double nextDouble() { return Double.parseDouble(nextString()); } public int[] nextIntArray(int n) { int[] res = new int[n]; for (int i = 0; i < n; i++) { res[i] = nextInt(); } return res; } public int[] nextIntArrayDec(int n) { int[] res = new int[n]; for (int i = 0; i < n; i++) { res[i] = nextInt() - 1; } return res; } public int[] nextIntArray1Index(int n) { int[] res = new int[n + 1]; for (int i = 0; i < n; i++) { res[i + 1] = nextInt(); } return res; } public long[] nextLongArray(int n) { long[] res = new long[n]; for (int i = 0; i < n; i++) { res[i] = nextLong(); } return res; } public long[] nextLongArrayDec(int n) { long[] res = new long[n]; for (int i = 0; i < n; i++) { res[i] = nextLong() - 1; } return res; } public long[] nextLongArray1Index(int n) { long[] res = new long[n + 1]; for (int i = 0; i < n; i++) { res[i + 1] = nextLong(); } return res; } public double[] nextDoubleArray(int n) { double[] res = new double[n]; for (int i = 0; i < n; i++) { res[i] = nextDouble(); } return res; } public InputReader(InputStream inputStream) { in = new BufferedReader(new InputStreamReader(inputStream)); tok = new StringTokenizer(""); } } }
Main.java:17: error: cannot find symbol TaskX solver = new TaskX(); ^ symbol: class TaskX location: class Main Main.java:17: error: cannot find symbol TaskX solver = new TaskX(); ^ symbol: class TaskX location: class Main 2 errors
s503874855
p03700
C++
#include <cstdio> #include <algorithm> #include <cmath> #include <cstdlib> #include <cstring>#include <cstdio> #include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <queue> #include <iostream> #include <bitset> using namespace std; #define N 100005 #define ll long long ll a[N],b[N],n,A,B; int check(ll x) { for(int i=1;i<=n;i++)b[i]=a[i]-x*B; for(int i=1;i<=n;i++)if(b[i]>0)x-=(ll)((1.0*b[i])/(1.0*A-B)+0.9999); return x>=0; } int main() { // freopen("Study.in","r",stdin);freopen("Study.out","w",stdout); scanf("%lld%lld%lld",&n,&A,&B); for(int i=1;i<=n;i++)scanf("%lld",&a[i]); ll l=1,r=1ll<<30; while(l<r) { ll m=(l+r)>>1; if(check(m))r=m; else l=m+1; }printf("%lld\n",l);return 0; } #include <queue> #include <iostream> #include <bitset> using namespace std; #define N 100005 #define ll long long ll a[N],b[N],n,A,B; int check(ll x) { memcpy(b,a,sizeof(a)); for(int i=1;i<=n;i++)b[i]=a[i]-x*B; for(int i=1;i<=n;i++)x-=(ll)(ceil(1.0*b[i]/(A-B))); return x>=0; } int main() { // freopen("Study.in","r",stdin);freopen("Study.out","w",stdout); scanf("%lld%lld%lld",&n,&A,&B); for(int i=1;i<=n;i++)scanf("%lld",&a[i]); ll l=1,r=1ll<<30; while(l<r) { ll m=(l+r)>>1; if(check(m))r=m; else l=m+1; }printf("%lld\n",l);return 0; }
a.cc:5:19: warning: extra tokens at end of #include directive 5 | #include <cstring>#include <cstdio> | ^ a.cc:42:4: error: redefinition of 'long long int a [100005]' 42 | ll a[N],b[N],n,A,B; | ^ a.cc:16:4: note: 'long long int a [100005]' previously declared here 16 | ll a[N],b[N],n,A,B; | ^ a.cc:42:9: error: redefinition of 'long long int b [100005]' 42 | ll a[N],b[N],n,A,B; | ^ a.cc:16:9: note: 'long long int b [100005]' previously declared here 16 | ll a[N],b[N],n,A,B; | ^ a.cc:42:14: error: redefinition of 'long long int n' 42 | ll a[N],b[N],n,A,B; | ^ a.cc:16:14: note: 'long long int n' previously declared here 16 | ll a[N],b[N],n,A,B; | ^ a.cc:42:16: error: redefinition of 'long long int A' 42 | ll a[N],b[N],n,A,B; | ^ a.cc:16:16: note: 'long long int A' previously declared here 16 | ll a[N],b[N],n,A,B; | ^ a.cc:42:18: error: redefinition of 'long long int B' 42 | ll a[N],b[N],n,A,B; | ^ a.cc:16:18: note: 'long long int B' previously declared here 16 | ll a[N],b[N],n,A,B; | ^ a.cc:43:5: error: redefinition of 'int check(long long int)' 43 | int check(ll x) | ^~~~~ a.cc:17:5: note: 'int check(long long int)' previously defined here 17 | int check(ll x) | ^~~~~ a.cc:50:5: error: redefinition of 'int main()' 50 | int main() | ^~~~ a.cc:23:5: note: 'int main()' previously defined here 23 | int main() | ^~~~
s776989217
p03700
C++
#include<iostream> #include<string> #include<algorithm> #include<vector> #include<queue> #include<map> #include<math.h> #include<iomanip> #include<set> #include<numeric> #include<cstring> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); #define REVERSE(v,n) reverse(v,v+n); #define VREVERSE(v) reverse(v.begin(), v.end()); #define ll long long #define pb(a) push_back(a) #define INF 999999999 #define m0(x) memset(x,0,sizeof(x)) #define fill(x,y) memset(x,y,sizeof(x)) using namespace std; #define int long long int dy[4] = { 0,0,1,-1 }; int dx[4] = { 1,-1,0,0 }; int dxx[8] = { 0,0,1,1,1,-1,-1,-1 }; int dyy[8] = { 1,-1,0,1,-1,0,1,-1 }; ll m = 1000000007; const int MOD = 1000000007; ll gcd(ll x, ll y) { ll m = max(x, y), n = min(x, y); if (m%n == 0)return n; else return gcd(m%n, n); } ll lcm(ll x, ll y) { return x / gcd(x, y)*y; } ll myPow(ll x, ll n, ll m) { if (n == 0) return 1; if (n % 2 == 0) return myPow(x * x % m, n / 2, m); else return x * myPow(x, n - 1, m) % m; } //a÷b以上の最小の整数 ll CEIL(ll a, ll b) { return (a + b - 1) / b; } long long nCr(int n, int r) { if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r) long long ans = 1; int i; for (i = 1; i <= r; i++) { ans *= n - r + i; ans /= i; } return ans; } int N, A, B; int h[100010], x[100010]; bool isOK(int K) { ll cnt = 0; REP(i, N) { if (B*K < h[i]) { cnt += CEIL(h[i] - B * K, A - B); } } if (cnt <= K)return true; else return false; } int binary_search() { int ng = 0; //「index = 0」が条件を満たすこともあるので、初期値は -1 ll ok = 1000000000; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size() /* ok と ng のどちらが大きいかわからないことを考慮 */ while (abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if (isOK(mid)) ok = mid; else ng = mid; } return ok; } int main() { cin >> N >> A >> B; REP(i, N) { cin >> h[i]; } int ans = binary_search(); cout << ans << endl; }
cc1plus: error: '::main' must return 'int'
s422012382
p03700
Java
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long a = sc.nextLong(); long b = sc.nextLong(); long[] h = new long[n]; for(int i = 0; i < n; i++) h[i] = sc.nextLong(); long l = 0, r = Integer.MAX_VALUE; while(r - l != 1) { long mid = (r + l) / 2; long[] x = Arrays.copyOf(h, h.length); long cnt = 0; for(int i = 0; i < x.length; i++) { if(x[i] - b × mid <= 0) continue; cnt += ((x[i] - b * mid) + (a - b - 1)) / (a - b); } if(mid >= cnt) r = mid; else l = mid; } System.out.println(r); } }
Main.java:18: error: illegal character: '\u00d7' if(x[i] - b ? mid <= 0) continue; ^ Main.java:18: error: not a statement if(x[i] - b ? mid <= 0) continue; ^ Main.java:18: error: ';' expected if(x[i] - b ? mid <= 0) continue; ^ 3 errors
s616183406
p03700
C++
#include <iostream> #include <vector> #include <algorithm> #define all(v) (v).begin(), (v).end() using namespace std; int ceil(int numerator, int denominator) { return (numerator/denominator + (numerator%denominator != 0)); } int possible(vector <int> H, long long A, long long B, long long explosions) { for(int i = 1; i < H.size(); i++) { H[i] -= (explosions*B); } int explosions_used = 0; for(int i = H.size() - 1; i > 0; i++) { explosions_used += ceil(A[i], A - B); } return (explosions_used <= explosions); } int main() { int no_of_monsters, A, B; cin >> no_of_monsters >> A >> B; vector <int> health(no_of_monsters + 1); for(int i = 1; i <= no_of_monsters; i++) cin >> health[i]; sort(all(health)); long long left = 1, right = 1e9; while(left <= right) { long long mid = (left + right) >> 1; if(possible(health, A, B, mid)) { if(mid == left || !possible(health, A, B, mid - 1)) { printf("%lld\n", mid); break; } else { right = mid - 1; } } else { left = mid + 1; } } return 0; }
a.cc: In function 'int possible(std::vector<int>, long long int, long long int, long long int)': a.cc:23:42: error: invalid types 'long long int[int]' for array subscript 23 | explosions_used += ceil(A[i], A - B); | ^
s338181965
p03700
C++
#include<iostream> #include<queue> #include<vector> #include<cmath> using namespace std; using ll = long long; bool isenough(int t, int A, int B, vector<int>& v) { ll sm = 0; for(int i = 0; i < v.size(); i++) { sm += ceil((double)(v[i] - B * t) / (A - B)); } if(sm > t) return false; else return true; } int main() { int N, A, B; cin >> N >> A >> B; vector<int> hs(N); for(int i = 0; i < N; i++) cin >> hs[i]; sort(hs.begin(), hs.end()); int ng = 0, ok = hs[N-1] / B + 1; while(abs(ng - ok) > 1) { int c = (ng + ok) / 2; if(isenough(c, A, B, hs)) ok = c; else ng = c; } cout << ok << endl; return 0; }
a.cc: In function 'int main()': a.cc:23:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 23 | sort(hs.begin(), hs.end()); | ^~~~ | sqrt
s076102902
p03700
C++
#include <iostream> #include <algorithm> #include <functional> #include<vector> #include<math.h> #include<bitset> #include<string> #include <deque> #include<queue> #include<map> using namespace std; int main() { long long int N,A,B; cin >> N>>A>>B; long long int H[100008]; for (int i = 0; i < N; i++) { cin >> H[i]; } long long int T; for () { for (int i = 0; i < N; i++) { } } return 0; }
a.cc: In function 'int main()': a.cc:23:14: error: expected primary-expression before ')' token 23 | for () { | ^ a.cc:29:9: error: expected primary-expression before 'return' 29 | return 0; | ^~~~~~ a.cc:28:10: error: expected ';' before 'return' 28 | } | ^ | ; 29 | return 0; | ~~~~~~ a.cc:29:9: error: expected primary-expression before 'return' 29 | return 0; | ^~~~~~ a.cc:28:10: error: expected ')' before 'return' 28 | } | ^ | ) 29 | return 0; | ~~~~~~ a.cc:23:13: note: to match this '(' 23 | for () { | ^
s394353715
p03700
C++
n , a, b = map(int,input().split()) teki = [] ans = 0 for i in range(n): teki.append(int(input())) q = a- b ss = max(teki) m =0 for i in range(n): u = teki[i] // b + 1 if m <= u: m = u for i in range(n): teki[i] = teki[i] - b * (m) if teki[i] <= 0: teki[i] == 0 ans += m while 0 in teki: teki.remove(0) """ while tekis != []: for i in range(len(tekis)): tekis[i] = tekis[i] - b k = max(tekis) tekis.remove(k) tekis.append(k + a- b) for i in range(len(tekis)): if tekis[i] <= 0: tekis[i] = 0 while 0 in tekis: tekis.remove(0) ans += 1 """ print(ans-1)
a.cc:25:3: warning: missing terminating " character 25 | """ | ^ a.cc:25:3: error: missing terminating " character a.cc:41:3: warning: missing terminating " character 41 | """ | ^ a.cc:41:3: error: missing terminating " character a.cc:1:1: error: 'n' does not name a type 1 | n , a, b = map(int,input().split()) | ^
s138565341
p03700
C++
#include <iostream> #include <functional> #include <vector> #include <iostream> #include <queue> using namespace std; bool cleared(vector<int> &v, int k, int a, int b){ int rest = k; int d = a-b; for (auto it=v.begin();it != v.end();it++) { rest -= (*it - k*b)/d; if ((*it - k*b)%d != 0) { rest--; } if (rest < 0) { return(false); } } return(true); } bool cmp(int a, int b) { return(a>b); } int main(){ // priority_queue<int> q; vector<int> v; int acc_b = 0; int n, a, b, d; int max_h; int count = 0; cin >> n >> a >> b; d = a - b; for (int i=0;i<n;i++) { int h; cin >> h; // q.push(h); v.push_back(h); } sort(v.begin(), v.end(), cmp); long long ub, lb, ans; lb = v.front()/a; ub = v.front()/b + 1; while (lb<=ub) { long long k = (ub + lb)/2; bool result = cleared(v, k, a, b); if (result) { if (k-1 == lb) { ans = k; break; } ub = k; } else { if (k+1 == ub) { ans = ub; break; } lb = k; } } cout << ans << endl; return(0); // while (true) { // max_h = q.top(); // if (acc_b >= max_h) { // break; // } // q.pop(); // cerr << max_h << endl; // q.push(max_h - d); // acc_b += b; // count++; // } // cout << count << endl; }
a.cc: In function 'int main()': a.cc:43:3: error: 'sort' was not declared in this scope; did you mean 'short'? 43 | sort(v.begin(), v.end(), cmp); | ^~~~ | short
s839414794
p03700
C++
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <cmath> #include <cstdlib> #include <tuple> using ll = long long; using namespace std; #define modmod 1000000007 int N; ll h[100006]; ll A,B; bool enough(ll t){ ll sum = 0; for(int i = 0; i < N; i++){ if(h[i]-(B*t) <= 0){ continue; } sum += (h[i]-(B*t))/(A-B); if((h[i]-(B*t))/(A-B) != 0){ sum++; } } return sum <= t; } int main(){ cin >> N >> A >> B; for(int i = 0; i < N; i++){ cin >> h[i]; } sort(h,h+N); ll max_h = h[N-1]; ll left = 0, right = max_h/B + 1; while(right - left > 1){ ll mid = (left+right) / 2; if(enough(mid)){ right=mid; }else{ left=mid; } } cout << right << mid; return 0; }
a.cc: In function 'int main()': a.cc:51:22: error: 'mid' was not declared in this scope 51 | cout << right << mid; | ^~~
s797072989
p03700
C++
#include<iostream> #include<vector> #include<string> #include<algorithm> using namespace std; int h[100009]; int main(){ int n; long long int a,b; cin>>n>>a>>b; for(int i=0;i<n;i++){ cin>>h[i]; } long long int sa=a-b; long long int mi=0,ma=1000000000,mid; while(ma-mi>1){ mid=(mi+ma)/2; long long int cnt=0; for(int i=0;i<n;i++){ if(h[i]>b*mid){ cnt+=,(h[i] - b * mid + a - b - 1) / (a-b); } } if(cnt>mid){ mi=mid; } else{ ma=mid; } } cout<<ma<<endl; return 0; }
a.cc: In function 'int main()': a.cc:21:38: error: expected primary-expression before ',' token 21 | cnt+=,(h[i] - b * mid + a - b - 1) / (a-b); | ^
s646625858
p03700
C++
#include <iostream> #include<cstdlib> #include<queue> #include<set> #include<vector> #include<string> #include<algorithm> #include<stack> #include<map> #include<deque> #include<cstdio> using namespace std; #define rep(i,a) for(int i=0;i<a;i++) #define mp make_pair #define pb push_back #define ll __int64 //#define ll long long #define P pair<ll,ll> int n,a,b; ll t[1100000]; ll tt[110000]; bool che(ll x){ rep(i,n)tt[i]=t[i]; ll cnt=0;//Aで殴る必要のある回数 rep(i,n){ tt[i]-=b*x; if(tt[i]>0){ cnt+=tt[i]/(a-b); if(tt[i]%(a-b))cnt++; } } if(cnt>x)return 0; else return 1; } int main(){ cin>>n>>a>>b; rep(i,n)cin>>t[i]; ll l=0,r=10000000001; ll mid=(l+r)/2; rep(i,100){ if(che(mid))r=mid; else l=mid; mid=(r+l)/2; } cout<<mid+1<<endl; return 0; }
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'? 16 | #define ll __int64 | ^~~~~~~ a.cc:21:1: note: in expansion of macro 'll' 21 | ll t[1100000]; | ^~ a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'? 16 | #define ll __int64 | ^~~~~~~ a.cc:22:1: note: in expansion of macro 'll' 22 | ll tt[110000]; | ^~ a.cc:16:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 16 | #define ll __int64 | ^~~~~~~ a.cc:24:10: note: in expansion of macro 'll' 24 | bool che(ll x){ | ^~ a.cc: In function 'int main()': a.cc:42:22: error: 't' was not declared in this scope 42 | rep(i,n)cin>>t[i]; | ^ a.cc:16:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 16 | #define ll __int64 | ^~~~~~~ a.cc:43:9: note: in expansion of macro 'll' 43 | ll l=0,r=10000000001; | ^~ a.cc:44:12: error: expected ';' before 'mid' 44 | ll mid=(l+r)/2; | ^~~ a.cc:47:24: error: 'mid' was not declared in this scope 47 | if(che(mid))r=mid; | ^~~ a.cc:47:27: error: 'che' cannot be used as a function 47 | if(che(mid))r=mid; | ^ a.cc:47:29: error: 'r' was not declared in this scope 47 | if(che(mid))r=mid; | ^ a.cc:48:22: error: 'l' was not declared in this scope 48 | else l=mid; | ^ a.cc:49:17: error: 'mid' was not declared in this scope 49 | mid=(r+l)/2; | ^~~ a.cc:49:22: error: 'r' was not declared in this scope 49 | mid=(r+l)/2; | ^ a.cc:49:24: error: 'l' was not declared in this scope 49 | mid=(r+l)/2; | ^ a.cc:52:15: error: 'mid' was not declared in this scope 52 | cout<<mid+1<<endl; | ^~~
s929062044
p03700
C++
#include <iostream> #include<cstdlib> #include<queue> #include<set> #include<vector> #include<string> #include<algorithm> #include<stack> #include<map> #include<deque> #include<cstdio> using namespace std; #define rep(i,a) for(int i=0;i<a;i++) #define mp make_pair #define pb push_back #define ll __int64 //#define ll long long #define P pair<ll,ll> int n,a,b; ll t[1100000]; ll tt[110000]; bool che(int x){ rep(i,n)tt[i]=t[i]; ll cnt=0;//Aで殴る必要のある回数 rep(i,n){ tt[i]-=b*x; if(tt[i]>0){ cnt+=tt[i]/(a-b); if(tt[i]%(a-b))cnt++; } } if(cnt>x)return 0; else return 1; } int main(){ cin>>n>>a>>b; rep(i,n)cin>>t[i]; ll l=1,r=1000000001; ll mid=(l+r)/2; rep(i,50){ if(che(mid))r=mid; else l=mid; mid=(r+l)/2; } cout<<mid+1<<endl; return 0; }
a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'? 16 | #define ll __int64 | ^~~~~~~ a.cc:21:1: note: in expansion of macro 'll' 21 | ll t[1100000]; | ^~ a.cc:16:12: error: '__int64' does not name a type; did you mean '__int64_t'? 16 | #define ll __int64 | ^~~~~~~ a.cc:22:1: note: in expansion of macro 'll' 22 | ll tt[110000]; | ^~ a.cc: In function 'bool che(int)': a.cc:25:17: error: 'tt' was not declared in this scope; did you mean 'tm'? 25 | rep(i,n)tt[i]=t[i]; | ^~ | tm a.cc:25:23: error: 't' was not declared in this scope 25 | rep(i,n)tt[i]=t[i]; | ^ a.cc:16:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 16 | #define ll __int64 | ^~~~~~~ a.cc:27:9: note: in expansion of macro 'll' 27 | ll cnt=0;//Aで殴る必要のある回数 | ^~ a.cc:29:17: error: 'tt' was not declared in this scope; did you mean 'tm'? 29 | tt[i]-=b*x; | ^~ | tm a.cc:32:25: error: 'cnt' was not declared in this scope; did you mean 'int'? 32 | cnt+=tt[i]/(a-b); | ^~~ | int a.cc:36:12: error: 'cnt' was not declared in this scope; did you mean 'int'? 36 | if(cnt>x)return 0; | ^~~ | int a.cc: In function 'int main()': a.cc:42:22: error: 't' was not declared in this scope 42 | rep(i,n)cin>>t[i]; | ^ a.cc:16:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 16 | #define ll __int64 | ^~~~~~~ a.cc:43:9: note: in expansion of macro 'll' 43 | ll l=1,r=1000000001; | ^~ a.cc:44:12: error: expected ';' before 'mid' 44 | ll mid=(l+r)/2; | ^~~ a.cc:47:24: error: 'mid' was not declared in this scope 47 | if(che(mid))r=mid; | ^~~ a.cc:47:29: error: 'r' was not declared in this scope 47 | if(che(mid))r=mid; | ^ a.cc:48:22: error: 'l' was not declared in this scope 48 | else l=mid; | ^ a.cc:49:17: error: 'mid' was not declared in this scope 49 | mid=(r+l)/2; | ^~~ a.cc:49:22: error: 'r' was not declared in this scope 49 | mid=(r+l)/2; | ^ a.cc:49:24: error: 'l' was not declared in this scope 49 | mid=(r+l)/2; | ^ a.cc:51:15: error: 'mid' was not declared in this scope 51 | cout<<mid+1<<endl; | ^~~ a.cc: In function 'bool che(int)': a.cc:38:1: warning: control reaches end of non-void function [-Wreturn-type] 38 | } | ^
s633622110
p03700
Java
import java.util.Arrays; import java.util.Iterator; import java.util.PrimitiveIterator; import java.util.Scanner; import java.util.function.BinaryOperator; import java.util.function.IntFunction; import java.util.stream.IntStream; import java.util.stream.Stream; class Main{ private void solve(){ int n=gInt(),a=gInt(),b=gInt(),h[]=ints(n).toArray(); System.out.println(bin(1,100000000,i->f(a,b,h,i))); } int bin(int l,int r,IntFunction<Integer> f){ while(true) { System.out.println(l+" "+r); int mid=(l+r)/2; int v=f.apply(mid); if(v==0) return mid; if(v>0) l=mid+1; else r=mid-1; } } int f(int a,int b,int[] h,int i){ return Arrays.stream(h) .map(o->(Math.max(0,o-b*i)+a-b-1)/(a-b)) .sum() -i; } public static class Merger<T>{ private T v; private BinaryOperator<T>f; public Merger(T init,BinaryOperator<T>merge){ v=init; f=merge; } public T update(T t) { return v=f.apply(v,t); } public T get() { return v; } } public static void main(String[]$){ new Main().solve(); } static Scanner s=new Scanner(System.in); static int gInt(){ return s.nextInt(); } static long gLong(){ return s.nextLong(); } static long gDouble(){ return s.nextLong(); } static Range rep(int i){ return new Range(i); } static Range rep(int f,int t,int d){ return new Range(f,t,d); } static Range rep(int f,int t){ return rep(f,t,1); } static Range rrep(int f,int t){ return rep(f,t,-1); } static class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{ int to,cur,d; Range(int from,int to,int d){ this.cur=from-d; this.to=to; this.d=d; } Range(int n){ this(0,n-1,1); } @Override public Iterator<Integer> iterator(){ return this; } @Override public boolean hasNext(){ return cur+d==to||(cur!=to&&(cur<to==cur+d<to)); } @Override public int nextInt(){ return cur+=d; } } static IntStream REPS(int v){ return IntStream.range(0,v); } static IntStream REPS(int l,int r){ return IntStream.rangeClosed(l,r); } static IntStream ints(int n){ return REPS(n).map(i->gInt()); } static Stream<String> strs(int n){ return REPS(n).mapToObj(i->s.next()); } }/
Main.java:132: error: class, interface, enum, or record expected }/ ^ 1 error
s518523929
p03700
C++
#include <iostream> #include <cctype> #include <algorithm> #include <vector> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <string> #include <cctype> #include <cstring> #include <cstdio> #include <cstdlib> #include <cmath> const int INF = 100000000, mod = 1000000007; using namespace std; long long n, a, b, h[100000]; bool check(long long pos) { long long count = 0; for (int i = 0; i < n; i++) { long long tmp = h[i] - b*pos, damage = a - b; res += max(0LL, (tmp + damage - 1) / damage); } return count <= pos; } int main() { cin >> n >> a >> b; for (int i = 0; i < n; i++) cin >> h[i]; long long left = 0, right = 1000000000; while (right-left>1) {//h[left]~h[right] long long pos = (left + right) / 2; if (check(pos)) right = pos; else left = pos; } cout << right << endl; return 0; }
a.cc: In function 'bool check(long long int)': a.cc:25:9: error: 'res' was not declared in this scope 25 | res += max(0LL, (tmp + damage - 1) / damage); | ^~~
s767628890
p03700
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; bool tobo(ll mid){ ll temp[N]; ll po = 0; for(ll i = 0; i < N; ++i){ ll yo = h[i] - mid * B; if(yo > 0) po += yo / (A - B) + (yo % (A - B) > 0); } if(yo > mid) return 0; else return 1; } int main(){ ll N ,A, B; cin >> N >> A >> B; ll h[N]; for(ll i = 0; i < N; ++i) cin >> h[i]; ll upper = 1e14, lower = 0; while(upper - lower > 1){ ll mid = (upper + lower) / 2; if(!tobo(upper, lower)) lower = mid; else upper = mid; } cout << (tobo(lower) ? lower : upper) << endl; return 0; }
a.cc: In function 'bool tobo(ll)': a.cc:6:17: error: 'N' was not declared in this scope 6 | ll temp[N]; | ^ a.cc:9:25: error: 'h' was not declared in this scope 9 | ll yo = h[i] - mid * B; | ^ a.cc:9:38: error: 'B' was not declared in this scope 9 | ll yo = h[i] - mid * B; | ^ a.cc:10:40: error: 'A' was not declared in this scope 10 | if(yo > 0) po += yo / (A - B) + (yo % (A - B) > 0); | ^ a.cc:12:12: error: 'yo' was not declared in this scope; did you mean 'po'? 12 | if(yo > mid) return 0; | ^~ | po a.cc: In function 'int main()': a.cc:23:25: error: too many arguments to function 'bool tobo(ll)' 23 | if(!tobo(upper, lower)) lower = mid; | ~~~~^~~~~~~~~~~~~~ a.cc:5:6: note: declared here 5 | bool tobo(ll mid){ | ^~~~ a.cc: In function 'bool tobo(ll)': a.cc:14:1: warning: control reaches end of non-void function [-Wreturn-type] 14 | } | ^
s426055054
p03700
C++
#include<cstdio> int n,a,b,h[100000],i,l,m,r; long long x; main(){ for(cin>>n>>a>>b),a-=b;i<n;l=1,r=1e9) cout<<h+i++; while(l<r){ m=(l+r)/2; for(x=i=0;i<n;++i)h[i]>(long long)m*b?x+=(h[i]-m*b+a-1)/a:0; x<=m?r=m:l=m+1; } cout<<l<<endl; }
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:5:7: error: 'cin' was not declared in this scope 5 | for(cin>>n>>a>>b),a-=b;i<n;l=1,r=1e9) cout<<h+i++; | ^~~ a.cc:5:41: error: 'cout' was not declared in this scope 5 | for(cin>>n>>a>>b),a-=b;i<n;l=1,r=1e9) cout<<h+i++; | ^~~~ a.cc:11:3: error: 'cout' was not declared in this scope 11 | cout<<l<<endl; | ^~~~ a.cc:11:12: error: 'endl' was not declared in this scope 11 | cout<<l<<endl; | ^~~~