submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s168135887
p03785
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 pair<int,int> P; const int INF = 1e9; const ll LINF = 1e18; const int MOD = INF+7; struct edge{int to,cost;}; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n,c,k; cin >> n >> c >> k; int t[n]; for(int i=0;i<n;i++){ cin >> t[i]; } sort(t,t+n); int ans=1,tmp; for(int i=0;i<n;){ auto e=upper_bound(t,t+n,t[i]+k); tmp=min(e-(&t[i]),c); i+=tmp; if(i<=n-1) ans++; else break; //cout << i << "人目の" << t[i] << "時で" << ans << "台目のバス登場 前のバスは" << tmp <<"人乗った\n"; } // int a=0,i=1; // while(true){ // if(a+i == n) break; // if(i<c && t[a]+k>=t[a+i]){ // i++; // }else{ // ans++; // a=a+i; // i=1; // } // } cout << ans << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:46:24: error: no matching function for call to 'min(long int, int&)' 46 | tmp=min(e-(&t[i]),c); | ~~~^~~~~~~~~~~~~ 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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:46:24: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'int') 46 | tmp=min(e-(&t[i]),c); | ~~~^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:46:24: note: mismatched types 'std::initializer_list<_Tp>' and 'long int' 46 | tmp=min(e-(&t[i]),c); | ~~~^~~~~~~~~~~~~
s077352747
p03785
Java
public int solve() { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int C = sc.nextInt(); int K = sc.nextInt(); int T[] = new int[N]; for(int i = 0; i < N; i++) { T[i] = sc.nextInt(); } int res = 1; int people = 0; int start = T[0] + K; int j = 0; while(j < N) { while(people < C && T[j] < start) { people++; j++; } res++; start = T[j] + K; j++; } //System.out.println("Res = " + res); return res; }
Main.java:1: error: unnamed classes are a preview feature and are disabled by default. public int solve() { ^ (use --enable-preview to enable unnamed classes) 1 error
s455699258
p03785
Java
public void solve(int testNumber, InputReader in, PrintWriter out) { System.out.println("Enter data"); Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int C = sc.nextInt(); int K = sc.nextInt(); int T[] = new int[N]; for(int i = 0; i < N; i++) { T[i] = sc.nextInt(); } int res = 1; int people = 0; int start = T[0] + K; int j = 0; while(j < N) { while(people < C && T[j] < start) { people++; j++; } res++; start = T[j] + K; j++; } System.out.println("Res = " + res); }
Main.java:1: error: unnamed classes are a preview feature and are disabled by default. public void solve(int testNumber, InputReader in, PrintWriter out) { ^ (use --enable-preview to enable unnamed classes) 1 error
s817467197
p03785
Java
// A. Airport bus import java.util.*; public class AtCoder011A { public void solve(int testNumber, InputReader in, PrintWriter out) { System.out.println("Enter data"); Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int C = sc.nextInt(); int K = sc.nextInt(); int T[] = new int[N]; for(int i = 0; i < N; i++) { T[i] = sc.nextInt(); } int res = 1; int people = 0; int start = T[0] + K; int j = 0; while(j < N) { while(people < C && T[j] < start) { people++; j++; } res++; start = T[j] + K; j++; } System.out.println("Res = " + res); } }
Main.java:5: error: class AtCoder011A is public, should be declared in a file named AtCoder011A.java public class AtCoder011A { ^ Main.java:6: error: cannot find symbol public void solve(int testNumber, InputReader in, PrintWriter out) { ^ symbol: class InputReader location: class AtCoder011A Main.java:6: error: cannot find symbol public void solve(int testNumber, InputReader in, PrintWriter out) { ^ symbol: class PrintWriter location: class AtCoder011A 3 errors
s888298564
p03785
Java
// A. Airport bus import java.util.*; public class AtCoder011A { public void solve() { System.out.println("Enter data"); Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int C = sc.nextInt(); int K = sc.nextInt(); int T[] = new int[N]; for(int i = 0; i < N; i++) { T[i] = sc.nextInt(); } System.out.println("Given data is : "); System.out.println("N = " + N); System.out.println("C = " + C); System.out.println("K = " + K); int res = 1; int people = 0; int start = T[0] + K; int j = 0; while(j < N) { while(people < C && T[j] < start) { people++; j++; } res++; start = T[j] + K; j++; } System.out.println("Res = " + res); } }
Main.java:4: error: class AtCoder011A is public, should be declared in a file named AtCoder011A.java public class AtCoder011A { ^ 1 error
s718868090
p03785
Java
// A. Airport bus import java.util.*; public class AtCoder011A { public static void main(String args[]) { System.out.println("Enter data"); Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int C = sc.nextInt(); int K = sc.nextInt(); int T[] = new int[N]; for(int i = 0; i < N; i++) { T[i] = sc.nextInt(); } System.out.println("Given data is : "); System.out.println("N = " + N); System.out.println("C = " + C); System.out.println("K = " + K); int res = 1; int people = 0; int start = T[0] + K; int j = 0; while(j < N) { while(people < C && T[j] < start) { people++; j++; } res++; start = T[j] + K; j++; } System.out.println("Res = " + res); } }
Main.java:4: error: class AtCoder011A is public, should be declared in a file named AtCoder011A.java public class AtCoder011A { ^ 1 error
s330883461
p03785
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int a[100005]; int main(){ ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); int n, c, k; cin >> n >> c >> k; for(int i = 0 ; i < n ; i++)cin >> a[i]; sort(a,a+n); int i = 0; int cnt =0; while(i!=n){ i = min(i+c, (upper_bound(a,a+n,a[i]+k)-a)); cnt++; //cout << cnt << ":" << i << endl; } cout << cnt; }
a.cc: In function 'int main()': a.cc:15:12: error: no matching function for call to 'min(int, long int)' 15 | i = min(i+c, (upper_bound(a,a+n,a[i]+k)-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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:15:12: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long int') 15 | i = min(i+c, (upper_bound(a,a+n,a[i]+k)-a)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:15:12: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 15 | i = min(i+c, (upper_bound(a,a+n,a[i]+k)-a)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s703067106
p03785
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int a[100005]; int main(){ ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); int n, c, k; cin >> n >> c >> k; for(int i = 0 ; i < n ; i++)cin >> a[i]; sort(a,a+n); int i = 0; int cnt =0; while(i!=n-1){ int j = min(i+c-1, (upper_bound(a,a+n,a[i]+k)-a)-1); if (i==j) i++; else i = j; cnt++; //cout << cnt << ":" << i << endl; } cout << cnt; }
a.cc: In function 'int main()': a.cc:15:16: error: no matching function for call to 'min(int, long int)' 15 | int j = min(i+c-1, (upper_bound(a,a+n,a[i]+k)-a)-1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:15:16: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long int') 15 | int j = min(i+c-1, (upper_bound(a,a+n,a[i]+k)-a)-1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:15:16: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 15 | int j = min(i+c-1, (upper_bound(a,a+n,a[i]+k)-a)-1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s819361377
p03785
C++
#include <iostream> #include <algorithm> #include <vector> using namespace std; typedef long long ll; int n,c,k,ans,x,b; int t[100005]; int main(void){ scanf("%d%d%d",&n,&c,&k); for(int i=0;i<n;i++)scanf("%d"t+i); sort(t,t+n); x=c+1; for(int i=0;i<n;i++){ if(++x>c||b+k<t){ ans++; x=1; b=t; } } printf("%d\n",ans); }
a.cc: In function 'int main()': a.cc:10:31: error: unable to find string literal operator 'operator""t' with 'const char [3]', 'long unsigned int' arguments 10 | for(int i=0;i<n;i++)scanf("%d"t+i); | ^~~~~ a.cc:14:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 14 | if(++x>c||b+k<t){ | ~~~^~ a.cc:17:15: error: invalid conversion from 'int*' to 'int' [-fpermissive] 17 | b=t; | ^ | | | int*
s534825365
p03785
C++
#include <bits/stdc++.h> using namespace std; #define EACH(i,a) for (auto& i : a) #define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i) #define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) RFOR(i,0,n) #define ALL(a) (a).begin(),(a).end()#define debug(x) cerr << #x << ":" << x << endl; #define OK(ok) cout << (ok ? "Yes" : "No") << endl; typedef long long ll; void CINT(){} template <class Head,class... Tail> void CINT(Head&& head,Tail&&... tail) { cin >> head; CINT(move(tail)...); } #define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__) #define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__) #define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__) const int INF = 1e9 + 1; const int MOD = 1e9 + 7; const int MAX_N = 1e5 + 1; int N, C, K; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> N >> C >> K; vector< int > T(N); REP(i, N) cin >> T[i]; sort(ALL(T)); int limit = -1; int cnt = 0; int ans = 0; REP(i, N) { if (limit < 0) { limit = T[i] + K; ans++; } if (limit < T[i] or cnt == C) { cnt = 0; limit = -1; } cnt++; } cout << ans << endl; return 0; }
a.cc:10:14: error: '#' is not followed by a macro parameter 10 | #define ALL(a) (a).begin(),(a).end()#define debug(x) cerr << #x << ":" << x << endl; | ^ a.cc: In function 'int main()': a.cc:39:8: error: 'ALL' was not declared in this scope 39 | sort(ALL(T)); | ^~~
s310098920
p03785
C++
def minimumNumberOfBus(a, c, k): foo = 0 a = sorted(a) cur = 0 while cur<len(a): departing_time = a[cur]+k space = c while space>0 and cur<len(a) and a[cur]<=departing_time: cur += 1 space -= 1 foo += 1 return foo def main(): n, c, k = [int(x) for x in raw_input().strip().split()] a = [0 for i in xrange(n)] for i in xrange(n): a[i] = int(raw_input().strip()) print minimumNumberOfBus(a, c, k) if __name__ == '__main__': main()
a.cc:21:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes 21 | if __name__ == '__main__': | ^~~~~~~~~~ a.cc:1:1: error: 'def' does not name a type 1 | def minimumNumberOfBus(a, c, k): | ^~~
s877596995
p03785
C++
include<iostream> #include<algorithm> using namespace std; typedef long long int ll; int main(){ int N, C, K, T[100000]; cin >> N >> C >> K; for(int i = 0; i < N; i++) cin >> T[i]; sort(T, T + N); int ans = 0; for(int i = 0; i < N; i++){ int s = T[i]; int cnt = 1; while(cnt < C && T[i + 1] - s <= K){ cnt++; i++; } ans++; } cout << ans << endl; return 0; }
a.cc:1:1: 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/algorithm:60, 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> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
s093670062
p03785
Java
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class Task { public void solve(int testNumber, Scanner in, PrintWriter out) { int n = in.nextInt(); int c = in.nextInt(); int k = in.nextInt(); int []t = new int[n]; for (int i = 0; i < n; ++i) { t[i] = in.nextInt(); } Arrays.sort(t); int people = 0; int start = 0; int res = 0; for (int tt : t) { if (people > 0 && tt - start > k) { ++res; people = 0; } if (people == 0) { start = tt; } ++people; if (people == c) { ++res; people = 0; } } if (people > 0) { ++res; } out.println(res); } }
Main.java:8: error: class Task is public, should be declared in a file named Task.java public class Task { ^ 1 error
s343287980
p03785
Java
package codes; import java.util.Scanner; import java.io.PrintWriter; import java.util.Arrays; public class Task { public void solve(int testNumber, Scanner in, PrintWriter out) { int n = in.nextInt(); int c = in.nextInt(); int k = in.nextInt(); int []t = new int[n]; for (int i = 0; i < n; ++i) { t[i] = in.nextInt(); } Arrays.sort(t); int people = 0; int start = 0; int res = 0; for (int tt : t) { if (people > 0 && tt - start > k) { ++res; people = 0; } if (people == 0) { start = tt; } ++people; if (people == c) { ++res; people = 0; } } if (people > 0) { ++res; } out.println(res); } }
Main.java:7: error: class Task is public, should be declared in a file named Task.java public class Task { ^ 1 error
s971157402
p03785
C++
#include<bits/stdc++.h using namespace std; using ll = int64_t; int main(){ ll n, c, k; cin >> n >> c >> k; ll t[n]; for(ll i = 0; i < n; i++) cin >> t[i]; sort(t, t + n); ll ans = 0, num = 1, s = t[0]; for(ll i = 1; i < n; i++){ if(t[i] > s + k || num == c){ num = 0; ans++; s = t[i]; } num++; } cout << ++ans << endl; return 0; }
a.cc:1:23: error: missing terminating > character 1 | #include<bits/stdc++.h | ^
s765217251
p03785
C++
#include <cassert> #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> /* //#if __cplusplus >= 201103L #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> */ // C++ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> /* //#if __cplusplus >= 201103L #include <array> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> */ using namespace std; #define fi first #define se second #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define each(itr,v) for(auto itr:v) #define pb(s) push_back(s) #define mmax(x,y) (x>y?x:y) #define mmin(x,y) (x<y?x:y) #define maxch(x,y) x=mmax(x,y) #define minch(x,y) x=mmin(x,y) #define mp(a,b) make_pair(a,b) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x"="<<x<<endl #define uni(x) x.erase(unique(all(x)),x.end()) template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;} template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;} #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) > (b) ? (b) : (a)) typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; typedef pair<P, int> PPI; #define INF INT_MAX/3 #define MAX_N 1000 #define M_INF 1000000000 int main(void) { ll n, c, k; cin>>n>>c>>k; vector<ll> t(n);cin>>t; sort(all(t)); ll i = 0; ll ret = 0; while (1) { ll first_i = i; ll tmp = 0; // ここでのiはバスに初めに載せる while (i < n && tmp < c && !(t[first_i]+k < t[i])) tmp++, i++; // ここでのiは次のバスの初めに載せる // 終了条件はwhileのnot // (0) i >= n、もうおわり // (1) バスが満タンになった -> ret++ // (2) 重ならない->ret++ ret++; if (i >= n) { cout << ret << endl; return 0; } } return 0; }
a.cc: In function 'int main()': a.cc:114:24: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<long long int>') 114 | vector<ll> t(n);cin>>t; | ~~~^~~ | | | | | std::vector<long long int> | 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 a.cc:32: /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>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /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>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /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>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /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>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /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>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /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>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /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>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'} 352 | operator>>(__streambuf_type* __sb); |
s351229826
p03785
C++
#include <cassert> #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> /* //#if __cplusplus >= 201103L #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> */ // C++ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> /* //#if __cplusplus >= 201103L #include <array> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> */ using namespace std; #define fi first #define se second #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define each(itr,v) for(auto itr:v) #define pb(s) push_back(s) #define mmax(x,y) (x>y?x:y) #define mmin(x,y) (x<y?x:y) #define maxch(x,y) x=mmax(x,y) #define minch(x,y) x=mmin(x,y) #define mp(a,b) make_pair(a,b) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x"="<<x<<endl #define uni(x) x.erase(unique(all(x)),x.end()) template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;} template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;} #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) > (b) ? (b) : (a)) typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; typedef pair<P, int> PPI; #define INF INT_MAX/3 #define MAX_N 1000 #define M_INF 1000000000 int main(void) { ll n, c, k; cin>>n>>c>>k; vll t(n);cin>>t; sort(all(t)); ll i = 0; ll ret = 0; while (1) { ll first_i = i; ll tmp = 0; // ここでのiはバスに初めに載せる while (i < n && tmp < c && !(t[first_i]+k < t[i])) tmp++, i++; // ここでのiは次のバスの初めに載せる // 終了条件はwhileのnot // (0) i >= n、もうおわり // (1) バスが満タンになった -> ret++ // (2) 重ならない->ret++ ret++; if (i >= n) { cout << ret << endl; return 0; } } return 0; }
a.cc: In function 'int main()': a.cc:114:5: error: 'vll' was not declared in this scope; did you mean 'ull'? 114 | vll t(n);cin>>t; | ^~~ | ull a.cc:114:19: error: 't' was not declared in this scope 114 | vll t(n);cin>>t; | ^
s814989395
p03785
C++
#define _CRT_SECURE_NO_WARNINGS #define _SCL_SECURE_NO_WARNINGS #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <string> #include <vector> #include <list> #include <utility> #include <algorithm> #include <functional> #include <cmath> #include <stack> #include <queue> #include <set> #include <map> #include <iomanip> #include <sstream> #include <bitset> #include <limits> #include <numeric> #include <valarray> #include <fstream> using namespace std; typedef unsigned int uint; typedef long long LL; typedef unsigned long long ULL; typedef pair<LL, LL> PP; #define REP(i,a,n) for(LL i = (a); i < (LL)(n); ++i) #define REM(i,a,n) for(LL i = ((n) - 1); i >= (a); --i) #define FLOAT fixed << setprecision(16) #define SPEEDUP {cin.tie(0); ios::sync_with_stdio(false);} const int INF = 0x3FFFFFFF; const LL INFLL = 0x3FFFFFFF3FFFFFFF; const double INFD = 1.0e+308; const string INFSTR = "\x7f"; const double EPS = 1.0e-9; void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; } void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; } template <class T, class U> istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; } template <class T, class U> ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; } template <class T, class TCompatible, size_t N> void Fill(T(&dest)[N], const TCompatible& val) { fill(dest, dest + N, val); } template <class T, class TCompatible, size_t M, size_t N> void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); } template<class T> T Compare(T left, T right) { return left > right ? 1 : (left < right ? -1 : 0); } istream& Ignore(istream& ist) { string s; ist >> s; return ist; } bool Inside(int i, int j, int h, int w) { return i >= 0 && i < h && j >= 0 && j < w; } // all_of // partial_sum, adjacent_difference #ifdef ONLY_MY_ENVIR #include "IntMod.h" #include "Union_Find.h" #include "Graph.h" #include "Range.h" #include "Global.h" #include "Flow_Solver.h" #include "Tree.h" #include "Suffix_Array.h" #include "Geometry.h" #include "Matrix.h" #endif #ifdef __GNUC__ typedef __int128 LLL; istream& operator>> (istream& ist, __int128& val) { LL tmp; ist >> tmp; val = tmp; return ist; } ostream& operator<< (ostream& ost, __int128 val) { LL tmp = val; ost << tmp; return ost; } #endif #if 1234567891 #include <array> #include <random> #include <unordered_set> #include <unordered_map> template<typename T> using PriorityQ = priority_queue<T, vector<T>, greater<T> >; // コスト小を優先 #endif struct MMStruct { MInt a, b, c; }; int N, C, K; int A[100000]; int main() { cin >> N >> C >> K; REP(i, 0, N) { cin >> A[i]; } sort(A, A + N, greater<int>()); int cnt = 0; for (int i = 0; i < N;) { ++cnt; int front = A[i]; int piv = i; while (A[i] >= front - K && i < piv + C && i < N) { ++i; } } cout << cnt << endl; return 0; }
a.cc:87:9: error: 'MInt' does not name a type 87 | MInt a, b, c; | ^~~~
s217938058
p03785
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(); int c = sc.nextInt(); int k = sc.nextInt(); int[] t = new int[n]; for(int i=0; i<n; i++){ t[i] = sc.nextInt(); } sc.close(); Arrays.sort(t); int ans = 0; int lt = t[0]; int ln = 0; for(int i=0; i<n-1; i++){ ln++; if(ln == c || t[i+1] - lt > k){ ln = 0; lt = t[i+1]; ans++; } } ans++; System.out.print(ans); } } }
Main.java:33: error: class, interface, enum, or record expected } ^ 1 error
s350145604
p03785
C++
#include <cstdio> #include <algorithm> using namespace std; int n, c, k, ans, x, a[100005]={-1e9}; int main() { int i; scanf("%d%d%d", &n, &c, &k); for(i=1; i<=n; i++) scanf("%d", &a[i]); sort(a, a+n+1); for(i=1; i<=n; i++) { if(x==0 || a[i]-a[i-1]>k) ans++, x=c; x--; } printf("%d", ans); return 0; }
a.cc:4:33: error: narrowing conversion of '-1.0e+9' from 'double' to 'int' [-Wnarrowing] 4 | int n, c, k, ans, x, a[100005]={-1e9}; | ^~~~
s223910232
p03785
Java
package main; import java.io.PrintWriter; import java.io.InputReader; public class TaskA { public void solve(int testNumber, InputReader in, PrintWriter out) { int n = in.nextInt(); int c = in.nextInt(); int k = in.nextInt(); int[] t = new int[n]; for (int i = 0; i < n; i++) { t[i] = in.nextInt(); } Arrays.sort(t); int people = 0; int start = 0; int res = 0; for (int tt : t) { if (people == 0) { start = tt; ++people; } else if ((tt <= (start + k)) && (people < c)) { ++people; } else { ++res; start = tt; people = 1; } } ++res; out.println(res); } }
Main.java:6: error: class TaskA is public, should be declared in a file named TaskA.java public class TaskA { ^ Main.java:4: error: cannot find symbol import java.io.InputReader; ^ symbol: class InputReader location: package java.io Main.java:7: error: cannot find symbol public void solve(int testNumber, InputReader in, PrintWriter out) { ^ symbol: class InputReader location: class TaskA Main.java:15: error: cannot find symbol Arrays.sort(t); ^ symbol: variable Arrays location: class TaskA 4 errors
s270092514
p03785
C++
#include "bits/stdc++.h" using namespace std; int main(){ long long int n,c,k; cin>>n>>c>>k; vector<int> t(n); for(int i=0;i<n;i++)cin>>t[i]; sort(t.begin(),t.end()); long long int np=0; long long int ans=0; long long int count=0; for(int i=0;i<n;i++){ if(cout>c){ ans++; count=1; np=t[i]; }else if(t[i]>np+k){ ans++; count=1; np=t[i]; }else{ count++; } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:16:24: error: no match for 'operator>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'long long int') 16 | if(cout>c){ | ~~~~^~ | | | | | long long int | std::ostream {aka std::basic_ostream<char>} a.cc:16:24: note: candidate: 'operator>(int, long long int)' (built-in) 16 | if(cout>c){ | ~~~~^~ a.cc:16:24: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed: a.cc:16:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 16 | if(cout>c){ | ^ /usr/include/c++/14/bits/regex.h:1236:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed: a.cc:16:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 16 | if(cout>c){ | ^ /usr/include/c++/14/bits/regex.h:1329:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1329 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed: a.cc:16:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 16 | if(cout>c){ | ^ /usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed: a.cc:16:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int' 16 | if(cout>c){ | ^ /usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1497 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed: a.cc:16:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 16 | if(cout>c){ | ^ /usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed: a.cc:16:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'long long int' 16 | if(cout>c){ | ^ /usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1673 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed: a.cc:16:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 16 | if(cout>c){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:16:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>' 16 | if(cout>c){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:16:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 16 | if(cout>c){ | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:16:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 16 | if(cout>c){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:16:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 16 | if(cout>c){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:16:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 16 | if(cout>c){ | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:16:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 16 | if(cout>c){ | ^ /usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:16:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 16 | if(cout>c){ | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:16:25: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long long int' 16 | if(cout>c){ | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits,
s705462506
p03785
C++
#include<cmath> #include<math.h> #include<ctype.h> #include<algorithm> #include<bitset> #include<cassert> #include<cctype> #include<cerrno> #include<cfloat> #include<ciso646> #include<climits> #include<clocale> #include<complex> #include<csetjmp> #include<csignal> #include<cstdarg> #include<cstddef> #include<cstdio> #include<cstdlib> #include<cstring> #include<ctime> #include<cwchar> #include<cwctype> #include<deque> #include<exception> #include<fstream> #include<functional> #include<iomanip> #include<ios> #include<iosfwd> #include<iostream> #include<istream> #include<iterator> #include<limits> #include<list> #include<locale> #include<map> #include<memory> #include<new> #include<numeric> #include<ostream> #include<queue> #include<set> #include<sstream> #include<stack> #include<stdexcept> #include<streambuf> #include<string> #include<typeinfo> #include<utility> #include<valarray> #include<vector> #include<string.h> #include<stdlib.h> #include<stdio.h> using namespace std; int n,m,I,P,Q; int cnt,head[100010],to[400010],next[400010],linker[100010]; bool f,vis[100010]; void add(int x,int y) { cnt++; to[cnt]=y; next[cnt]=head[x]; head[x]=cnt; } void dfs(int x,int fa) { vis[x]=true; linker[x]=linker[fa]^1; for (int i=head[x];i;i=next[i]) { int y=to[i]; if (y!=fa) { if (vis[y]) { if (linker[x]==linker[y]) { f=true; } continue; } else { dfs(y,x); } } } } int main() { scanf("%d%d",&n,&m); int x,y; for (int i=0;i<m;i++) { scanf("%d%d",&x,&y); add(x,y); add(y,x); } for (int i=1;i<=n;i++) { if (!vis[i]) { if (head[i]) { I++; vis[i]=true; continue; } f=false; dfs(i,0); if (f) { P++; } else { Q++; } } } long long ans=2LL*I*n-1LL*I*I+1LL*P*P+2LL*P*Q+2LL*Q*Q; printf("%lld\n",ans); return 0; }
a.cc: In function 'void add(int, int)': a.cc:64:9: error: reference to 'next' is ambiguous 64 | next[cnt]=head[x]; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:66, from /usr/include/c++/14/bits/specfun.h:43, from /usr/include/c++/14/cmath:3906, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:58:33: note: 'int next [400010]' 58 | int cnt,head[100010],to[400010],next[400010],linker[100010]; | ^~~~ a.cc: In function 'void dfs(int, int)': a.cc:71:32: error: reference to 'next' is ambiguous 71 | for (int i=head[x];i;i=next[i]) | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:58:33: note: 'int next [400010]' 58 | int cnt,head[100010],to[400010],next[400010],linker[100010]; | ^~~~
s195701006
p03785
C++
¥#include <vector> #include <iostream> #include <utility> #include <algorithm> #include <string> #include <deque> #include <queue> #include <tuple> #include <queue> #include <functional> #include <cmath> #include <iomanip> #include <map> #include <set> #include <numeric> #include <unordered_map> #include <unordered_set> #include <complex> #include <iterator> #include <array> #include <memory> #include <stack> #define vi vector<int> #define vvi vector<vector<int> > #define ll long long int #define vl vector<ll> #define vvl vector<vector<ll>> #define vb vector<bool> #define vc vector<char> #define vs vector<string> #define ld long double #define INF 1e9 #define EPS 0.0000000001 #define rep(i,n) for(int i=0;i<n;i++) #define loop(i,s,n) for(int i=s;i<n;i++) #define all(in) in.begin(), in.end() template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; } template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; } #define MAX 9999999 using namespace std; typedef pair<int, int> pii; typedef pair<double,double>pdd; signed main(){ int n,c,k; cin>>n>>c>>k; vi v(n,0); rep(i,n)cin>>v[i]; sort(all(v)); auto itr=v.begin(); int key=v[0]; int ans=0; while(true){ ans++; auto next=upper_bound(itr, ((v.end()-(itr+c-1))>=0?itr+c-1:v.end()),key+k-1); if(next==v.end())break; itr=next; key=*itr; } cout<<ans<<endl; }
a.cc:1:1: error: extended character ¥ is not valid in an identifier 1 | ¥#include <vector> | ^ a.cc:1:2: error: stray '#' in program 1 | ¥#include <vector> | ^ a.cc:1:1: error: '\U000000a5' does not name a type 1 | ¥#include <vector> | ^ In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/exception_ptr.h:38, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared 140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared 142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:145:52: error: expected primary-expression before 'const' 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:147:54: error: expected primary-expression before 'const' 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive] 155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:156:70: error: expected primary-expression before 'const' 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive] 163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:164:72: error: expected primary-expression before 'const' 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared 171 | void operator delete(void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared 173 | void operator delete[](void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function 179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _G
s404856230
p03785
C++
¥#include <vector> #include <iostream> #include <utility> #include <algorithm> #include <string> #include <deque> #include <queue> #include <tuple> #include <queue> #include <functional> #include <cmath> #include <iomanip> #include <map> #include <set> #include <numeric> #include <unordered_map> #include <unordered_set> #include <complex> #include <iterator> #include <array> #include <memory> #include <stack> #define vi vector<int> #define vvi vector<vector<int> > #define ll long long int #define vl vector<ll> #define vvl vector<vector<ll>> #define vb vector<bool> #define vc vector<char> #define vs vector<string> #define ld long double #define INF 1e9 #define EPS 0.0000000001 #define rep(i,n) for(int i=0;i<n;i++) #define loop(i,s,n) for(int i=s;i<n;i++) #define all(in) in.begin(), in.end() template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; } template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; } #define MAX 9999999 using namespace std; typedef pair<int, int> pii; typedef pair<double,double>pdd; signed main(){ int n,c,k; cin>>n>>c>>k; vi v(n); rep(i,n)cin>>v[i]; sort(all(v)); bool flag=true; auto itr=v.begin(); int key=0; int ans=0; while(flag){ ans++; auto next=lower_bound(itr,v.end(),key+k); if(next==v.end())break; if(next-itr<=c){ itr=next; if(itr==v.end()) flag=false; key=*next; continue;} else{ itr=itr+c; if(itr>=v.end())break; key=*itr; } } cout<<ans<<endl; }
a.cc:1:1: error: extended character ¥ is not valid in an identifier 1 | ¥#include <vector> | ^ a.cc:1:2: error: stray '#' in program 1 | ¥#include <vector> | ^ a.cc:1:1: error: '\U000000a5' does not name a type 1 | ¥#include <vector> | ^ In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/exception_ptr.h:38, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared 140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared 142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:145:52: error: expected primary-expression before 'const' 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:147:54: error: expected primary-expression before 'const' 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive] 155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:156:70: error: expected primary-expression before 'const' 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive] 163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:164:72: error: expected primary-expression before 'const' 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared 171 | void operator delete(void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared 173 | void operator delete[](void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function 179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _G
s387799573
p03785
C++
#include <iostream> #include <algorithm> using namespace std; int n, c, k; int t[100010]; int main(){ cin >> n >> c >> k; for(int i = 0; i < n; i++) cin >> t[i]; sort(t, t+n); int count = 0; int j = 0; while(j < n){ int hito = 0; while(hito < c){ if(t[j+1] <= t[j]+k){ hito++; j++; }else{ j++; break; } count++; } cout << count << endl; return 0; }
a.cc: In function 'int main()': a.cc:28:2: error: expected '}' at end of input 28 | } | ^ a.cc:8:11: note: to match this '{' 8 | int main(){ | ^
s315507722
p03785
C++
#include <iostream> #include <algorithm> using namespace std; int n, c, k; int t[100010]; int main(){ cin >> n >> c >> k; for(int i = 0; i < n; i++) cin >> t[i]; sort(t, t+n); int count = 0; int j = 0; while(j < n){ int hito = 0; while(hito < c){ if(t[j+1] <= t[j]+k){ hito++; j++; }else{ j++; break; }å count++; } cout << count << endl; return 0; }
a.cc: In function 'int main()': a.cc:23:8: error: '\U000000e5' was not declared in this scope 23 | }å | ^ a.cc:28:2: error: expected '}' at end of input 28 | } | ^ a.cc:8:11: note: to match this '{' 8 | int main(){ | ^
s791013078
p03785
C++
Last login: Wed Jul 26 10:34:29 on ttys000 [csws037:~] t1745036% ls Desktop Library PWD_REMAIN_DAY Source Documents Movies Pictures a.out Downloads Music Public [csws037:~] t1745036% ls Desktop Library PWD_REMAIN_DAY Source Documents Movies Pictures a.out Downloads Music Public [csws037:~] t1745036% ls Desktop Library PWD_REMAIN_DAY Source Documents Movies Pictures a.out Downloads Music Public [csws037:~] t1745036% cd Documents/ [csws037:~/Documents] t1745036% wls wls: Command not found. [csws037:~/Documents] t1745036% ls AtCoder Seiha Enshu c_test MATLAB jisyu MyObjCApp プロ演1-2Qレポー?ト.docx Processing [csws037:~/Documents] t1745036% cd AtCoder/ [csws037:~/Documents/AtCoder] t1745036% ls abc052 abc058 agc018 [csws037:~/Documents/AtCoder] t1745036% mkdir agc011 [csws037:~/Documents/AtCoder] t1745036% ls abc052 abc058 agc011 agc018 [csws037:~/Documents/AtCoder] t1745036% cd agc011 [csws037:~/Documents/AtCoder/agc011] t1745036% ls [csws037:~/Documents/AtCoder/agc011] t1745036% vi a.cpp [csws037:~/Documents/AtCoder/agc011] t1745036% g++ -o a a.cpp [csws037:~/Documents/AtCoder/agc011] t1745036% ./a 5 3 5 1 2 3 6 12 2 [csws037:~/Documents/AtCoder/agc011] t1745036% vi a.cpp [csws037:~/Documents/AtCoder/agc011] t1745036% vi a.cpp [csws037:~/Documents/AtCoder/agc011] t1745036% g++ -o a a.cpp [csws037:~/Documents/AtCoder/agc011] t1745036% ./a 5 3 5 1 2 3 6 12 1:1 2:2 3:1 6:2 2 [csws037:~/Documents/AtCoder/agc011] t1745036% vi a.cpp [csws037:~/Documents/AtCoder/agc011] t1745036% g++ -o a a.cpp [csws037:~/Documents/AtCoder/agc011] t1745036% ./a 5 3 5 1 2 3 6 12 1:0 2:1 3:2 6:0 12:0 0:1 0:2 3 [csws037:~/Documents/AtCoder/agc011] t1745036% vi a.cpp [csws037:~/Documents/AtCoder/agc011] t1745036% g++ -o a a.cpp [csws037:~/Documents/AtCoder/agc011] t1745036% ./a 6 3 3 7 6 2 8 10 6 3 [csws037:~/Documents/AtCoder/agc011] t1745036% vi a.cpp int j = 0; while(j < n){ int hito = 0; while(hito < c){ if(t[j+1] <= t[j]+k){ hito++; j++; }else{ j++; break; } } count++; } cout << count << endl; return 0; }
a.cc:21:41: warning: `\U000030d5\U0000309a\U000030ed\U00006f141' is not in NFC [-Wnormalized=] 21 | MyObjCApp <U+30D5><U+309A><U+30ED><U+6F14>1-2Q<U+30EC><U+30DB><U+309A><U+30FC>?<U+30C8>.docx | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:21:49: warning: `2Qレポー' is not in NFC [-Wnormalized=] 21 | MyObjCApp <U+30D5><U+309A><U+30ED><U+6F14>1-2Q<U+30EC><U+30DB><U+309A><U+30FC>?<U+30C8>.docx | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:1:1: error: 'Last' does not name a type 1 | Last login: Wed Jul 26 10:34:29 on ttys000 | ^~~~ a.cc:87:3: error: expected unqualified-id before 'while' 87 | while(j < n){ | ^~~~~ a.cc:100:3: error: 'cout' does not name a type 100 | cout << count << endl; | ^~~~ a.cc:101:3: error: expected unqualified-id before 'return' 101 | return 0; | ^~~~~~ a.cc:102:1: error: expected declaration before '}' token 102 | } | ^
s522370393
p03785
Java
import java.util.*; public class agco11A { public static void main(String args[]) { int n,c,k; Scanner sc=new Scanner(System.in); n=sc.nextInt(); c=sc.nextInt(); k=sc.nextInt(); int[] t=new int[n]; for(int i=0;i<n;i++) t[i]=sc.nextInt(); Arrays.sort(t); int i=0,start,bus=1,people=0; start=t[0]; while(i<n) { if(t[i]-start>k) { bus++; people=0; } people++; if(people==1) start=t[i]; if(people==c) { bus++; people=0; } i++; } System.out.print(bus); } }
Main.java:3: error: class agco11A is public, should be declared in a file named agco11A.java public class agco11A ^ 1 error
s188539530
p03785
C++
#include <cstdio> #include <cstring> #include <iostream> #include <vector> #include <algorith> using namespace std; #define int long long #define DEBUG(X) cerr<<__LINE__<<" "<<#X<<": "<<X<<endl; #define REP(i,y) for(int i=0;i<(int)(y);i++) #define REPP(i,y) for(int i=1;i<=(int)(y);i++) #define sci(x) int x;scanf("%d",&x); #define scii(x, y) int x,y;scanf("%d%d",&x,&y); typedef long long ll; template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); } template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); } signed main() { int N,C,K; cin >> N >> C >> K; vector<int> T(N); ll max=-10; REP(i,N) { cin >> T[i]; } sort(T.begin(),T.end()); int cur=0; int ans=0; // 時刻T[i]に到着する全員を乗せるのに必要な最小時間を計算する while(cur<N) { int nex = cur; // ans番目のバスが次の客を乗せられるのは以下の条件を満たすときと同値. while (nex<N && (nex - cur < C) && T[nex] - T[cur] <= K) nex++; ans++; cur=nex; } cout << ans << endl; }
a.cc:5:10: fatal error: algorith: No such file or directory 5 | #include <algorith> | ^~~~~~~~~~ compilation terminated.
s429372672
p03785
C++
#include <cstdio> #include <cstring> #include <iostream> #include <vector> using namespace std; #define int long long #define DEBUG(X) cerr<<__LINE__<<" "<<#X<<": "<<X<<endl; #define REP(i,y) for(int i=0;i<(int)(y);i++) #define REPP(i,y) for(int i=1;i<=(int)(y);i++) #define sci(x) int x;scanf("%d",&x); #define scii(x, y) int x,y;scanf("%d%d",&x,&y); typedef long long ll; template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); } template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); } signed main() { int N,C,K; cin >> N >> C >> K; vector<int> T(N); ll max=-10; REP(i,N) { cin >> T[i]; } sort(T.begin(),T.end()); int cur=0; int ans=0; // 時刻T[i]に到着する全員を乗せるのに必要な最小時間を計算する while(cur<N) { int nex = cur; // ans番目のバスが次の客を乗せられるのは以下の条件を満たすときと同値. while (nex<N && (nex - cur < C) && T[nex] - T[cur] <= K) nex++; ans++; cur=nex; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:26:3: error: 'sort' was not declared in this scope; did you mean 'short'? 26 | sort(T.begin(),T.end()); | ^~~~ | short
s807613473
p03785
C++
left = middle; } } int pos = left; if(t[right]<=x){ pos = right; } return pos; } bool vis[maxn]; int main(){ int i,j; scanf("%d%d%d",&n,&c,&k); for(i=1;i<=n;i++){ scanf("%lld",t+i); } sort(t+1, t+1+n); memset(vis, true, sizeof(vis)); int p = 1; int kpos; long long res = 0; int last = -1; while(vis[n]){ kpos = findpos(p, t[p]+k); int another = (kpos-p+1)%c; res += (kpos-p+1)/c; for(i=p;i<=kpos-another;i++){ vis[i] = false; } p = kpos - another+1; if(p == last){ res++; for(i=p;i<=kpos;i++){ vis[i] =false; } p = kpos + 1; continue; } last = p; } printf("%lld\n",res); return 0; }
a.cc:2:13: error: 'left' does not name a type 2 | left = middle; | ^~~~ a.cc:3:9: error: expected declaration before '}' token 3 | } | ^ a.cc:4:5: error: expected declaration before '}' token 4 | } | ^ a.cc:5:15: error: 'left' was not declared in this scope 5 | int pos = left; | ^~~~ a.cc:6:5: error: expected unqualified-id before 'if' 6 | if(t[right]<=x){ | ^~ a.cc:9:5: error: expected unqualified-id before 'return' 9 | return pos; | ^~~~~~ a.cc:10:1: error: expected declaration before '}' token 10 | } | ^ a.cc:11:10: error: 'maxn' was not declared in this scope 11 | bool vis[maxn]; | ^~~~ a.cc: In function 'int main()': a.cc:14:21: error: 'n' was not declared in this scope 14 | scanf("%d%d%d",&n,&c,&k); | ^ a.cc:14:24: error: 'c' was not declared in this scope 14 | scanf("%d%d%d",&n,&c,&k); | ^ a.cc:14:27: error: 'k' was not declared in this scope 14 | scanf("%d%d%d",&n,&c,&k); | ^ a.cc:14:5: error: 'scanf' was not declared in this scope 14 | scanf("%d%d%d",&n,&c,&k); | ^~~~~ a.cc:16:22: error: 't' was not declared in this scope 16 | scanf("%lld",t+i); | ^ a.cc:18:10: error: 't' was not declared in this scope 18 | sort(t+1, t+1+n); | ^ a.cc:18:5: error: 'sort' was not declared in this scope; did you mean 'short'? 18 | sort(t+1, t+1+n); | ^~~~ | short a.cc:19:12: error: 'vis' was not declared in this scope 19 | memset(vis, true, sizeof(vis)); | ^~~ a.cc:19:5: error: 'memset' was not declared in this scope 19 | memset(vis, true, sizeof(vis)); | ^~~~~~ a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' +++ |+#include <cstring> 1 | a.cc:25:16: error: 'findpos' was not declared in this scope 25 | kpos = findpos(p, t[p]+k); | ^~~~~~~ a.cc:42:5: error: 'printf' was not declared in this scope 42 | printf("%lld\n",res); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 |
s695163036
p03785
C++
// 簡易競プロテンプレ #include <bits/stdc++.h> #define ll long long using namespace std; ll n, c, k; ll t[114514]; int main(void){ cin >> n >> c >> k; for(int i=0;i<n;i++) cin >> t[i]; sort(&t[0], &t[n]); ll ans = 0, offs = 0; for(int i=1;i<n;i++){ if (t[offs]+k>t[i] && i+1<n) continue; offs = min(offs+c, i); ans++; if (i+1<n) i--; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:13: error: no matching function for call to 'min(long long int, int&)' 14 | offs = min(offs+c, i); ans++; | ~~~^~~~~~~~~~~ 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:2: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:14:13: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 14 | offs = min(offs+c, i); ans++; | ~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:14:13: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 14 | offs = min(offs+c, i); ans++; | ~~~^~~~~~~~~~~
s354182858
p03785
Java
public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int c = sc.nextInt(); int k = sc.nextInt(); int[] a = new int[n]; for(int i = 0;i < n; i++){ a[i] = sc.nextInt(); } Arrays.sort(a); int cnt = 1; int wait = a[0]; int ans = 1; for(int i = 1; i < n; i++){ if(cnt == c||a[i] - wait > k){ ans++; cnt = 1; wait = a[i]; } cnt++; } System.out.println(ans); } }
Main.java:3: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:11: error: cannot find symbol Arrays.sort(a); ^ symbol: variable Arrays location: class Main 3 errors
s304939766
p03785
C++
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #ifdef PRINTERS #include "printers.hpp" using namespace printers; #define tr(a) cerr<<#a<<": "<<a<<endl; #else #define tr(a) #endif #define int long long #define ll long long #define pb push_back #define mp make_pair #define pii pair<int,int> #define vi vector<int> #define all(a) (a).begin(),(a).end() #define F first #define S second #define sz(x) (int)x.size() #define hell 1000000007 #define endl '\n' #define rep(i,a,b) for(int i=a;i<b;i++) using namespace std; signed solve(){ int N; cin>>N; int n=N; vi x(N); vi y(N); rep(i,0,N)cin>>x[i]; sort(all(x)); partial_sum(all(x),y.begin()); int ans=0; for(int i=n-1;i>=0;i--){ if(i==n-1 or y[i]*2>=y[i+1])ans++; else break; } cout<<ans; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t=1; // cin>>t; while(t--){ solve(); } return 0; }
a.cc: In function 'int solve()': a.cc:56:1: warning: no return statement in function returning non-void [-Wreturn-type] 56 | } | ^ At global scope: cc1plus: error: '::main' must return 'int'
s337182970
p03785
Java
import java.util.Arrays; import java.util.Scanner; public class AirportBus { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); int n = s.nextInt(); int c = s.nextInt(); int k = s.nextInt(); int a[] = new int[n]; int b[] = new int[n]; int d[] = new int[n]; int x = 0, y = 0; for (int i = 0; i < n; i++) { a[i] = s.nextInt(); } Arrays.sort(a); for (int j = 0; j < n; j++) { d[j] = a[j] + k; } int i = 0; while (i < n) { x = 0; int j = i; int flag = 0; while (j < n) { if (d[i] >= a[j] && a[j] >= a[i] && (x<c)) { x++; flag = 1; } j++; } if (flag == 1) { y++; } i = i + x; } System.out.println(y); } }
Main.java:5: error: class AirportBus is public, should be declared in a file named AirportBus.java public class AirportBus { ^ 1 error
s019362466
p03785
Java
import java.util.Arrays; import java.util.Scanner; public class airportbus { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); int n = s.nextInt(); int c = s.nextInt(); int k = s.nextInt(); int ans = 0, count = 0; int curr = Integer.MIN_VALUE; int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = s.nextInt(); } Arrays.sort(arr); for (int i = 0; i < n; i++) { if (curr + k < arr[i] || count >= c) { curr = arr[i]; count = 1; ans++; } else{ count++; } } System.out.println(ans); } }
Main.java:5: error: class airportbus is public, should be declared in a file named airportbus.java public class airportbus { ^ 1 error
s702817084
p03785
C++
#include<bits/stdc++.h> #include<sstream> #include<ext/pb_ds/tree_policy.hpp> using namespace std; #define mod 1000000007 #define all(v) v.begin(),v.end() #define loop(i,a,b) for(i=(ll)a;i<(ll)b;i++) #define revloop(i,a,b) for(i=(int)a;i>=(int)b;i--) #define stloop(it,v) for(it=v.begin();it!=v.end();++it) #define ii pair<int,int> #define MP make_pair #define pb push_back #define ll long long int #define PI acos(-1.0) #define f first #define se second #define rs resize int n,k,c; vector<int> a; bool can(int no) {     int i=0,j,Lm;     while(no>0 && i<n)     {        Lm=a[i]+k;        for(j=i+1;j<i+c,j<n;j++)          if(a[j]>Lm)            break;        i=j;        no--;     }     if(no>0 && i>n)       return true;     if(no<=0 && i<n) return false; return true; } int main() {  std::ios::sync_with_stdio(false);    cin.tie(0);    cout.tie(0);    int lo,hg,mid,i,ans;    cin>>n>>c>>k;    a.rs(n);    loop(i,0,n)     cin>>a[i]; sort(all(a));    lo=1;    hg=n;    while(lo<hg)    {        mid=(lo+hg)/2;        if(can(mid))        { ans=mid;           hg=mid-1;        }        else          lo=mid+1;    }    cout<<ans;   return 0; }
a.cc:22:1: error: extended character   is not valid in an identifier 22 |     int i=0,j,Lm; | ^ a.cc:22:1: error: extended character   is not valid in an identifier a.cc:22:1: error: extended character   is not valid in an identifier a.cc:23:1: error: extended character   is not valid in an identifier 23 |     while(no>0 && i<n) | ^ a.cc:23:1: error: extended character   is not valid in an identifier a.cc:23:1: error: extended character   is not valid in an identifier a.cc:24:1: error: extended character   is not valid in an identifier 24 |     { | ^ a.cc:24:1: error: extended character   is not valid in an identifier a.cc:24:1: error: extended character   is not valid in an identifier a.cc:25:1: error: extended character   is not valid in an identifier 25 |        Lm=a[i]+k; | ^ a.cc:25:1: error: extended character   is not valid in an identifier a.cc:25:1: error: extended character   is not valid in an identifier a.cc:25:1: error: extended character   is not valid in an identifier a.cc:25:1: error: extended character   is not valid in an identifier a.cc:25:1: error: extended character   is not valid in an identifier a.cc:26:1: error: extended character   is not valid in an identifier 26 |        for(j=i+1;j<i+c,j<n;j++) | ^ a.cc:26:1: error: extended character   is not valid in an identifier a.cc:26:1: error: extended character   is not valid in an identifier a.cc:26:1: error: extended character   is not valid in an identifier a.cc:26:1: error: extended character   is not valid in an identifier a.cc:26:1: error: extended character   is not valid in an identifier a.cc:27:1: error: extended character   is not valid in an identifier 27 |          if(a[j]>Lm) | ^ a.cc:27:1: error: extended character   is not valid in an identifier a.cc:27:1: error: extended character   is not valid in an identifier a.cc:27:1: error: extended character   is not valid in an identifier a.cc:27:1: error: extended character   is not valid in an identifier a.cc:27:1: error: extended character   is not valid in an identifier a.cc:27:1: error: extended character   is not valid in an identifier a.cc:27:1: error: extended character   is not valid in an identifier a.cc:28:1: error: extended character   is not valid in an identifier 28 |            break; | ^ a.cc:28:1: error: extended character   is not valid in an identifier a.cc:28:1: error: extended character   is not valid in an identifier a.cc:28:1: error: extended character   is not valid in an identifier a.cc:28:1: error: extended character   is not valid in an identifier a.cc:28:1: error: extended character   is not valid in an identifier a.cc:28:1: error: extended character   is not valid in an identifier a.cc:28:1: error: extended character   is not valid in an identifier a.cc:28:1: error: extended character   is not valid in an identifier a.cc:28:1: error: extended character   is not valid in an identifier a.cc:29:1: error: extended character   is not valid in an identifier 29 |        i=j; | ^ a.cc:29:1: error: extended character   is not valid in an identifier a.cc:29:1: error: extended character   is not valid in an identifier a.cc:29:1: error: extended character   is not valid in an identifier a.cc:29:1: error: extended character   is not valid in an identifier a.cc:29:1: error: extended character   is not valid in an identifier a.cc:30:1: error: extended character   is not valid in an identifier 30 |        no--; | ^ a.cc:30:1: error: extended character   is not valid in an identifier a.cc:30:1: error: extended character   is not valid in an identifier a.cc:30:1: error: extended character   is not valid in an identifier a.cc:30:1: error: extended character   is not valid in an identifier a.cc:30:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier 31 |     } | ^ a.cc:31:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier a.cc:32:1: error: extended character   is not valid in an identifier 32 |     if(no>0 && i>n) | ^ a.cc:32:1: error: extended character   is not valid in an identifier a.cc:32:1: error: extended character   is not valid in an identifier a.cc:33:1: error: extended character   is not valid in an identifier 33 |       return true; | ^ a.cc:33:1: error: extended character   is not valid in an identifier a.cc:33:1: error: extended character   is not valid in an identifier a.cc:33:1: error: extended character   is not valid in an identifier a.cc:33:1: error: extended character   is not valid in an identifier a.cc:34:1: error: extended character   is not valid in an identifier 34 |     if(no<=0 && i<n) | ^ a.cc:34:1: error: extended character   is not valid in an identifier a.cc:34:1: error: extended character   is not valid in an identifier a.cc:39:2: error: extended character   is not valid in an identifier 39 | {  std::ios::sync_with_stdio(false); | ^ a.cc:40:1: error: extended character   is not valid in an identifier 40 |    cin.tie(0); | ^ a.cc:40:1: error: extended character   is not valid in an identifier a.cc:41:1: error: extended character   is not valid in an identifier 41 |    cout.tie(0); | ^ a.cc:41:1: error: extended character   is not valid in an identifier a.cc:42:1: error: extended character   is not valid in an identifier 42 |    int lo,hg,mid,i,ans; | ^ a.cc:42:1: error: extended character   is not valid in an identifier a.cc:43:1: error: extended character   is not valid in an identifier 43 |    cin>>n>>c>>k; | ^ a.cc:43:1: error: extended character   is not valid in an identifier a.cc:44:1: error: extended character   is not valid in an identifier 44 |    a.rs(n); | ^ a.cc:44:1: error: extended character   is not valid in an identifier a.cc:45:1: error: extended character   is not valid in an identifier 45 |    loop(i,0,n) | ^ a.cc:45:1: error: extended character   is not valid in an identifier a.cc:46:1: error: extended character   is not valid in an identifier 46 |     cin>>a[i]; | ^ a.cc:46:1: error: extended character   is not valid in an identifier a.cc:46:1: error: extended character   is not valid in an identifier a.cc:48:1: error: extended character   is not valid in an identifier 48 |    lo=1; | ^ a.cc:48:1: error: extended character   is not valid in an identifier a.cc:49:1: error: extended character   is not valid in an identifier 49 |    hg=n; | ^ a.cc:49:1: error: extended character   is not valid in an identifier a.cc:50:1: error: extended character   is not valid in an identifier 50 |    while(lo<hg) | ^ a.cc:50:1: error: extended character   is not valid in an identifier a.cc:51:1: error: extended character   is not valid in an identifier 51 |    { | ^ a.cc:51:1: error: extended character   is not valid in an identifier a.cc:52:1: error: extended character   is not valid in an identifier 52 |        mid=(lo+hg)/2; | ^ a.cc:52:1: error: extended character   is not valid in an identifier a.cc:52:1: error: extended character   is not valid in an identifier a.cc:52:1: error: extended character   is not valid in an identifier a.cc:52:1: error: extended character   is not valid in an identifier a.cc:52:1: error: extended character   is not valid in an identifier a.cc:53:1: error: extended character   is not valid in an identifier 53 |        if(can(mid)) | ^ a.cc:53:1: error: extended character   is not valid in an identifier a.cc:53:1: error: extended character   is not valid in an identifier a.cc:53:1: error: extended character   is not valid in an identifier a.cc:53:1: error: extended character   is not valid in an identifier a.cc:53:1: error: extended character   is not valid in an identifier a.cc:54:1: error: extended character   is not valid in an identifier 54 |        { ans=mid; | ^ a.cc:54:1: error: extended character   is not valid in an identifier a.cc:54:1: error: extended character   is not valid in an identifier a.cc:54:1: error: extended character   is not valid in an identifier a.cc:54:1: error: extended character   is not valid in an identifier a.cc:54:1: error: extended character   is not valid in an identifier a.cc:55:1: error: extended character   is not valid in an identifier 55 |           hg=mid-1; | ^ a.cc:55:1: error: extended character   is not valid in an identifier a.cc:55:1: error: extended character   is not valid in an identifier a.cc:55:1: error: extended character   is not valid in an identifier a.cc:55:1: error: extended character   is not valid in an identifier a.cc:55:1: error: extended character   is not valid in an identifier a.cc:55:1: error: extended character   is not valid in an identifier a.cc:55:1: error: extended character   is not valid in an identifier a.cc:55:1: error: extended character   is not valid in an identifier a.cc:56:1: error: extended character   is not valid in an identifier 56 |        } | ^ a.cc:56:1: error: extended character   is not valid in an identifier a.cc:56:1: error: extended character   is not valid in an identifier a.cc:56:1: error: extended character   is not valid in an identifier a.cc:56:1: error: extended character   is not valid in an identifier a.cc:56:1: error: extended character   is not valid in an identifier a.cc:57:1: error: extended character   is not valid in an identifier 57 |        else | ^ a.cc:57:1: error: extended character   is not valid in an identifier a.cc:57:1: error: extended character   is not valid in an identifier a.cc:57:1: error: extended character   is not valid in an identifier a.cc:57:1: error: extended character   is not valid in an identifier a.cc:57:1: error: extended character   is not valid in an identifier a.cc:58:1: error: extended character   is not valid in an identifier 58
s405752967
p03785
C++
/code #include<bits/stdc++.h> #include<sstream> #include<ext/pb_ds/tree_policy.hpp> using namespace std; #define mod 1000000007 #define all(v) v.begin(),v.end() #define loop(i,a,b) for(i=(ll)a;i<(ll)b;i++) #define revloop(i,a,b) for(i=(int)a;i>=(int)b;i--) #define stloop(it,v) for(it=v.begin();it!=v.end();++it) #define ii pair<int,int> #define MP make_pair #define pb push_back #define ll long long int #define PI acos(-1.0) #define f first #define se second #define rs resize int n,k,c; vector<int> a; bool can(int no) {     int i=0,j,Lm;     while(no>0 && i<n)     {        Lm=a[i]+k;        for(j=i+1;j<i+c,j<n;j++)          if(a[j]>Lm)            break;        i=j;        no--;     }     if(no>0 && i>n)       return true;     if(no<=0 && i<n) return false; return true; } int main() {  std::ios::sync_with_stdio(false);    cin.tie(0);    cout.tie(0);    int lo,hg,mid,i,ans;    cin>>n>>c>>k;    a.rs(n);    loop(i,0,n)     cin>>a[i]; sort(all(a));    lo=1;    hg=n;    while(lo<hg)    {        mid=(lo+hg)/2;        if(can(mid))        { ans=mid;           hg=mid-1;        }        else          lo=mid+1;    }    cout<<ans;   return 0; }
a.cc:23:1: error: extended character   is not valid in an identifier 23 |     int i=0,j,Lm; | ^ a.cc:23:1: error: extended character   is not valid in an identifier a.cc:23:1: error: extended character   is not valid in an identifier a.cc:24:1: error: extended character   is not valid in an identifier 24 |     while(no>0 && i<n) | ^ a.cc:24:1: error: extended character   is not valid in an identifier a.cc:24:1: error: extended character   is not valid in an identifier a.cc:25:1: error: extended character   is not valid in an identifier 25 |     { | ^ a.cc:25:1: error: extended character   is not valid in an identifier a.cc:25:1: error: extended character   is not valid in an identifier a.cc:26:1: error: extended character   is not valid in an identifier 26 |        Lm=a[i]+k; | ^ a.cc:26:1: error: extended character   is not valid in an identifier a.cc:26:1: error: extended character   is not valid in an identifier a.cc:26:1: error: extended character   is not valid in an identifier a.cc:26:1: error: extended character   is not valid in an identifier a.cc:26:1: error: extended character   is not valid in an identifier a.cc:27:1: error: extended character   is not valid in an identifier 27 |        for(j=i+1;j<i+c,j<n;j++) | ^ a.cc:27:1: error: extended character   is not valid in an identifier a.cc:27:1: error: extended character   is not valid in an identifier a.cc:27:1: error: extended character   is not valid in an identifier a.cc:27:1: error: extended character   is not valid in an identifier a.cc:27:1: error: extended character   is not valid in an identifier a.cc:28:1: error: extended character   is not valid in an identifier 28 |          if(a[j]>Lm) | ^ a.cc:28:1: error: extended character   is not valid in an identifier a.cc:28:1: error: extended character   is not valid in an identifier a.cc:28:1: error: extended character   is not valid in an identifier a.cc:28:1: error: extended character   is not valid in an identifier a.cc:28:1: error: extended character   is not valid in an identifier a.cc:28:1: error: extended character   is not valid in an identifier a.cc:28:1: error: extended character   is not valid in an identifier a.cc:29:1: error: extended character   is not valid in an identifier 29 |            break; | ^ a.cc:29:1: error: extended character   is not valid in an identifier a.cc:29:1: error: extended character   is not valid in an identifier a.cc:29:1: error: extended character   is not valid in an identifier a.cc:29:1: error: extended character   is not valid in an identifier a.cc:29:1: error: extended character   is not valid in an identifier a.cc:29:1: error: extended character   is not valid in an identifier a.cc:29:1: error: extended character   is not valid in an identifier a.cc:29:1: error: extended character   is not valid in an identifier a.cc:29:1: error: extended character   is not valid in an identifier a.cc:30:1: error: extended character   is not valid in an identifier 30 |        i=j; | ^ a.cc:30:1: error: extended character   is not valid in an identifier a.cc:30:1: error: extended character   is not valid in an identifier a.cc:30:1: error: extended character   is not valid in an identifier a.cc:30:1: error: extended character   is not valid in an identifier a.cc:30:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier 31 |        no--; | ^ a.cc:31:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier a.cc:31:1: error: extended character   is not valid in an identifier a.cc:32:1: error: extended character   is not valid in an identifier 32 |     } | ^ a.cc:32:1: error: extended character   is not valid in an identifier a.cc:32:1: error: extended character   is not valid in an identifier a.cc:33:1: error: extended character   is not valid in an identifier 33 |     if(no>0 && i>n) | ^ a.cc:33:1: error: extended character   is not valid in an identifier a.cc:33:1: error: extended character   is not valid in an identifier a.cc:34:1: error: extended character   is not valid in an identifier 34 |       return true; | ^ a.cc:34:1: error: extended character   is not valid in an identifier a.cc:34:1: error: extended character   is not valid in an identifier a.cc:34:1: error: extended character   is not valid in an identifier a.cc:34:1: error: extended character   is not valid in an identifier a.cc:35:1: error: extended character   is not valid in an identifier 35 |     if(no<=0 && i<n) | ^ a.cc:35:1: error: extended character   is not valid in an identifier a.cc:35:1: error: extended character   is not valid in an identifier a.cc:40:2: error: extended character   is not valid in an identifier 40 | {  std::ios::sync_with_stdio(false); | ^ a.cc:41:1: error: extended character   is not valid in an identifier 41 |    cin.tie(0); | ^ a.cc:41:1: error: extended character   is not valid in an identifier a.cc:42:1: error: extended character   is not valid in an identifier 42 |    cout.tie(0); | ^ a.cc:42:1: error: extended character   is not valid in an identifier a.cc:43:1: error: extended character   is not valid in an identifier 43 |    int lo,hg,mid,i,ans; | ^ a.cc:43:1: error: extended character   is not valid in an identifier a.cc:44:1: error: extended character   is not valid in an identifier 44 |    cin>>n>>c>>k; | ^ a.cc:44:1: error: extended character   is not valid in an identifier a.cc:45:1: error: extended character   is not valid in an identifier 45 |    a.rs(n); | ^ a.cc:45:1: error: extended character   is not valid in an identifier a.cc:46:1: error: extended character   is not valid in an identifier 46 |    loop(i,0,n) | ^ a.cc:46:1: error: extended character   is not valid in an identifier a.cc:47:1: error: extended character   is not valid in an identifier 47 |     cin>>a[i]; | ^ a.cc:47:1: error: extended character   is not valid in an identifier a.cc:47:1: error: extended character   is not valid in an identifier a.cc:49:1: error: extended character   is not valid in an identifier 49 |    lo=1; | ^ a.cc:49:1: error: extended character   is not valid in an identifier a.cc:50:1: error: extended character   is not valid in an identifier 50 |    hg=n; | ^ a.cc:50:1: error: extended character   is not valid in an identifier a.cc:51:1: error: extended character   is not valid in an identifier 51 |    while(lo<hg) | ^ a.cc:51:1: error: extended character   is not valid in an identifier a.cc:52:1: error: extended character   is not valid in an identifier 52 |    { | ^ a.cc:52:1: error: extended character   is not valid in an identifier a.cc:53:1: error: extended character   is not valid in an identifier 53 |        mid=(lo+hg)/2; | ^ a.cc:53:1: error: extended character   is not valid in an identifier a.cc:53:1: error: extended character   is not valid in an identifier a.cc:53:1: error: extended character   is not valid in an identifier a.cc:53:1: error: extended character   is not valid in an identifier a.cc:53:1: error: extended character   is not valid in an identifier a.cc:54:1: error: extended character   is not valid in an identifier 54 |        if(can(mid)) | ^ a.cc:54:1: error: extended character   is not valid in an identifier a.cc:54:1: error: extended character   is not valid in an identifier a.cc:54:1: error: extended character   is not valid in an identifier a.cc:54:1: error: extended character   is not valid in an identifier a.cc:54:1: error: extended character   is not valid in an identifier a.cc:55:1: error: extended character   is not valid in an identifier 55 |        { ans=mid; | ^ a.cc:55:1: error: extended character   is not valid in an identifier a.cc:55:1: error: extended character   is not valid in an identifier a.cc:55:1: error: extended character   is not valid in an identifier a.cc:55:1: error: extended character   is not valid in an identifier a.cc:55:1: error: extended character   is not valid in an identifier a.cc:56:1: error: extended character   is not valid in an identifier 56 |           hg=mid-1; | ^ a.cc:56:1: error: extended character   is not valid in an identifier a.cc:56:1: error: extended character   is not valid in an identifier a.cc:56:1: error: extended character   is not valid in an identifier a.cc:56:1: error: extended character   is not valid in an identifier a.cc:56:1: error: extended character   is not valid in an identifier a.cc:56:1: error: extended character   is not valid in an identifier a.cc:56:1: error: extended character   is not valid in an identifier a.cc:56:1: error: extended character   is not valid in an identifier a.cc:57:1: error: extended character   is not valid in an identifier 57 |        } | ^ a.cc:57:1: error: extended character   is not valid in an identifier a.cc:57:1: error: extended character   is not valid in an identifier a.cc:57:1: error: extended character   is not valid in an identifier a.cc:57:1: error: extended character   is not valid in an identifier a.cc:57:1: error: extended character   is not valid in an identifier a.cc:58:1: error: extended character   is not valid in an identifier 58 |        else | ^ a.cc:58:1: error: extended character   is not valid in an identifier a.cc:58:1: error: extended character   is not valid in an identifier a.cc:58:1: error: extended character   is not valid in an identifier a.cc:58:1: error: extended character   is not valid in an identifier a.cc:58:1: error: extended character   is not valid in an identifier a.cc:59:1: error: extended character   is not valid in an identifier 59
s700329707
p03785
Java
import java.util.*; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int C = sc.nextInt(); int K = sc.nextInt(); int a[] = new int[N]; for (int i = 0; i < N; i++) a[i] = sc.nextInt(); Arrays.sort(a); int ans = 0, cnt = 0, st = 0; for (int i = 0; i < N;) { if (cnt == C) { ans++; cnt = 0; } else if (cnt == 0) { st = a[i++] + K; cnt++; } else { if (a[i] <= st) { cnt++; i++; } else { ans++; cnt = 0; } } } if (cnt > 0) { ans++; } System.out.println(ans); } }
Main.java:3: error: class A is public, should be declared in a file named A.java public class A { ^ 1 error
s266727229
p03785
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,c,k,ans=0;bool t=true; scanf("%d %d %d", &n, &c,&k); vector<int>v(n); for(int i=0;i<n;++i)scanf("%d",&v[i]); sort(v.begin(),v.end()); for(auto it=v.cbegin();t;++ans){ const int x=*it+k; for(int i=0;*it<=x&&i<c&&t=it!=v.cend();++i,++it); } printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:11:28: error: lvalue required as left operand of assignment 11 | for(int i=0;*it<=x&&i<c&&t=it!=v.cend();++i,++it); | ~~~~~~~~~~~^~~
s076232640
p03785
C++
// ALLAH \\ whoishussain.org #include<bits/stdc++.h> using namespace std; main(){ int n, t = 0, sum = 0; cin >>n; for(int i = 0;i < n;i ++){ int a;cin >> a; if( sum * 2 < a ) t = i; sum += a; } cout << n - t << endl;
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:13:23: error: expected '}' at end of input 13 | cout << n - t << endl; | ^ a.cc:5:7: note: to match this '{' 5 | main(){ | ^
s843807941
p03785
C++
#include <bits/stdc++.h> using namespace std; int main() { /*freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);*/ int n,c,k; cin>>n>>c>>k; int t[n]; for(int i=0;i<n;i++) { cin>>t[i]; } sort(t,t+n); int j=0,b=0,cpt=0; for(int i=0;i<n;i++) { if(t[i]>t[j]+k || cpt==c) { j=i; b++; cpt=1; } else cpt++; } cout<<++b<<endl; return 0; } #include <bits/stdc++.h> using namespace std; int main() { /*freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);*/ int n,c,k; cin>>n>>c>>k; int t[n]; for(int i=0;i<n;i++) { cin>>t[i]; } sort(t,t+n); int j=0,b=0,cpt=0; for(int i=0;i<n;i++) { if(t[i]>t[j]+k || cpt==c) { j=i; b++; cpt=1; } else cpt++; } cout<<++b<<endl; return 0; }
a.cc:34:5: error: redefinition of 'int main()' 34 | int main() | ^~~~ a.cc:4:5: note: 'int main()' previously defined here 4 | int main() | ^~~~
s281418384
p03785
C++
#include <iostream> using namespace std; #define MAX 100000 int p[MAX]; int main() { int N,C,K; int b=0; cin>>N>>C>>K; for(int i=0;i<N;i++) { cin>>p[i]; } sort(p,p+N); int end,cap; for(int i=0;i<N;) { end=p[i]+K-1; cap=1; b++; while (cap < C && p[i] < end && i<N) { cap++; i++; } } cout<<b<<endl; return 0; }
a.cc: In function 'int main()': a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'short'? 17 | sort(p,p+N); | ^~~~ | short
s243938583
p03785
C++
c#include <algorithm> #include <bitset> #include <deque> #include <exception> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int,int> pii; typedef vector< pii > vpi; #define s(a) sort((a).begin(),(a).end()) #define FOR(i,a,n) for(int i=a;i<n;++i) #define forall(i,a,n) for(int i=a;i<=n;++i) #define pb push_back #define fi first #define se second #define mp make_pair #define sz(a) int((a).size()) #define all(c) (a).begin(),(a).end() #define char2int(c) (c-'0') #define IOS ios_base::sync_with_stdio(0); #define printA(a,n) forall(i,0,n) cout<<a[i]<<(i==R?'\n':" ") #define printV(a) printA(a,v.size()) #define MOD 1000000007 #define MAXN 100005 int a[MAXN]; int main(){ int n,c,k; cin>>n>>c>>k; FOR(i,0,n) cin>>a[i]; FOR(i,0,n) a[i]+=k; sort(a,a+n); int ans = 0; FOR(i,0,n){ int newI = i,ctr=1; while(ctr<=c&&i+ctr<n&&a[i]+c>=a[i+ctr]){ newI++; ctr++; } ans++; i=newI; } cout<<ans<<'\n'; }
a.cc:1:2: error: stray '#' in program 1 | c#include <algorithm> | ^ a.cc:1:1: error: 'c' does not name a type 1 | c#include <algorithm> | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/bitset:49, 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> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867
s889470166
p03785
C++
#include "stdafx.h" #include <iostream> #include <vector> #include <algorithm> using namespace std; #define int long long int n, c, k; int T[101010]; bool Tv[101010] = { false }; signed main() { cin >> n >> c >> k; for (int i = 0; i < n; i++) { cin >> T[i]; } sort(T, T + n); int busCnt = 0; for (int i = 0; i < n; i++) { if (Tv[i]) continue; Tv[i] = true; int capa = c - 1; for (int j = i + 1; j < n; j++) { if (!Tv[j] && T[j] <= T[i] + c) { capa--; Tv[j] = true; if (capa == 0) break; } } busCnt++; } cout << busCnt << endl; return 0; }
a.cc:1:10: fatal error: stdafx.h: No such file or directory 1 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s434752675
p03785
C++
#include <iostream> #include <cstdio> #include <algorithm> #include <cstdlib> #include <cstring> using namespace std; #define FOR(i,a,b) for (int i = (a); i < (b); i++) #define REP(i,n) FOR(i,0,n) typedef long long ll; ll t[100001]; ll time[100001]; int main(){ ll n, c, k; scanf("%lld %lld %lld", &n, &c, &k); REP(i,n) scanf("%lld", &t[i]); sort(t,t+n); REP(i,n){ time[i] = t[i] - t[0]; } ll b = 0; ll l = 0; ll cnt = 0; REP(i,n){ cnt++; if (time[i] - time[l] > k || cnt == 3){ if (cnt == 2) b++; cnt = 0; b++; l = i+1; } } printf("%lld\n", b); return 0; }
a.cc:15:15: error: 'll time [100001]' redeclared as different kind of entity 15 | ll time[100001]; | ^ In file included from /usr/include/pthread.h:23, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157, from /usr/include/c++/14/ext/atomicity.h:35, from /usr/include/c++/14/bits/ios_base.h:39, 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/time.h:76:15: note: previous declaration 'time_t time(time_t*)' 76 | extern time_t time (time_t *__timer) __THROW; | ^~~~ a.cc: In function 'int main()': a.cc:27:23: warning: pointer to a function used in arithmetic [-Wpointer-arith] 27 | time[i] = t[i] - t[0]; | ^ a.cc:27:25: error: assignment of read-only location '*(time + ((sizetype)i))' 27 | time[i] = t[i] - t[0]; | ~~~~~~~~^~~~~~~~~~~~~ a.cc:36:27: warning: pointer to a function used in arithmetic [-Wpointer-arith] 36 | if (time[i] - time[l] > k || cnt == 3){ | ^ a.cc:36:37: warning: pointer to a function used in arithmetic [-Wpointer-arith] 36 | if (time[i] - time[l] > k || cnt == 3){ | ^ a.cc:36:29: error: ISO C++ forbids using pointer to a function in subtraction [-fpermissive] 36 | if (time[i] - time[l] > k || cnt == 3){ | ~~~~~~~~^~~~~~~~~
s008593270
p03785
C++
#include <algorithm>//min/max/sort(rand-access it)/merge #include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific #include <vector> using namespace std; typedef unsigned long long ull; int main(void) { ui n, c, k; cin >> n >> c >> k; std::vector<ui> t; for (size_t i = 0; i < n; ++i) { ui temp; cin >> temp; t.push_back(temp); } if (c == 1) { cout << n << endl; return 0; } sort(t.begin(), t.end()); ull buses = 0UL; ui first_t = t[0]; ui current_load = 1; for (size_t i = 1; i < n; ++i) { if (current_load == c || first_t + k < t[i]) { ++buses; first_t = t[i]; current_load = 1; } else { ++current_load; } } cout << ++buses << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:5: error: 'ui' was not declared in this scope 11 | ui n, c, k; | ^~ a.cc:12:12: error: 'n' was not declared in this scope 12 | cin >> n >> c >> k; | ^ a.cc:12:17: error: 'c' was not declared in this scope 12 | cin >> n >> c >> k; | ^ a.cc:12:22: error: 'k' was not declared in this scope 12 | cin >> n >> c >> k; | ^ a.cc:13:19: error: template argument 2 is invalid 13 | std::vector<ui> t; | ^ a.cc:15:11: error: expected ';' before 'temp' 15 | ui temp; | ^~~~~ | ; a.cc:16:16: error: 'temp' was not declared in this scope; did you mean 'tm'? 16 | cin >> temp; | ^~~~ | tm a.cc:17:11: error: request for member 'push_back' in 't', which is of non-class type 'int' 17 | t.push_back(temp); | ^~~~~~~~~ a.cc:23:12: error: request for member 'begin' in 't', which is of non-class type 'int' 23 | sort(t.begin(), t.end()); | ^~~~~ a.cc:23:23: error: request for member 'end' in 't', which is of non-class type 'int' 23 | sort(t.begin(), t.end()); | ^~~ a.cc:26:7: error: expected ';' before 'first_t' 26 | ui first_t = t[0]; | ^~~~~~~~ | ; a.cc:27:7: error: expected ';' before 'current_load' 27 | ui current_load = 1; | ^~~~~~~~~~~~~ | ; a.cc:29:13: error: 'current_load' was not declared in this scope 29 | if (current_load == c || first_t + k < t[i]) { | ^~~~~~~~~~~~ a.cc:29:34: error: 'first_t' was not declared in this scope 29 | if (current_load == c || first_t + k < t[i]) { | ^~~~~~~ a.cc:29:49: error: invalid types 'int[size_t {aka long unsigned int}]' for array subscript 29 | if (current_load == c || first_t + k < t[i]) { | ^ a.cc:31:24: error: invalid types 'int[size_t {aka long unsigned int}]' for array subscript 31 | first_t = t[i]; | ^
s845398555
p03785
Java
import java.util.Scanner; public class AtCoder_GrandContest11_1 { static int N; static long C, K; static long[] T; public static void main(String[] args) { Scanner in = new Scanner(System.in); N = Integer.valueOf(in.nextInt()); // Number of passengers C = Long.valueOf(in.nextLong()); // Size of bus K = Long.valueOf(in.nextLong()); // Max wait time T = new long[N]; // Arrival timings for (int x = 0; x < N; x++) { T[x] = in.nextLong(); } sort(0, N - 1); } public static void sort (int low, int high) { int l = low, h = high; long p = T[low + (high-low)/2]; while (l < h) { while (T[l] < p) { l++; } while (T[h] > p) { h--; } if (l <= h) { long t = T[l]; T[l] = T[h]; T[h] = t; l++; h--; } } if (low < h) { sort(low, h); } else if (l < high) { sort(l, high); } else { printAns(); } } public static void printAns() { int Ti = 0; // Current passenger int buses = 0; while (Ti != N){ // UpperBound = T + K for (int x = Ti; x <= Ti + C; x++) { if (x == N || x == Ti + C || T[x] > T[Ti] + K) { buses++; Ti = x; break; } } } System.out.println(buses); } }
Main.java:3: error: class AtCoder_GrandContest11_1 is public, should be declared in a file named AtCoder_GrandContest11_1.java public class AtCoder_GrandContest11_1 { ^ 1 error
s846179023
p03785
C++
#include <iostream> #include <stdlib.h> #include <utility> using namespace std; const int MaxN=100003; int n,c,k,res=0,nnx=0,nny=0,idx[MaxN],idy[MaxN],trx[8*MaxN],trey[8*MaxN]; bool dau[MaxN]; struct ta{ int x,y;}; ta a[MaxN]; ta b[2*MaxN]; void upx(int i){ if (idx[i]==0){ nnx++; idx[i]=nnx; trx[nnx]=i; } int cha=nnx,hh=a[i].x,con=cha/2; while (con>0){ if (a[trx[cha]].x<=hh) break; trx[cha*2]=trx[cha]; idx[trx[cha]]=cha*2; cha=con; con=cha/2; } idx[i]=cha; trx[cha]=i; } void upy(int i){ if (idy[i]==0){ nny++; idy[i]=nny; trey[nny]=i; } int cha=nny,hh=a[i].y,con=cha/2; while (con>0){ if (a[trey[cha]].x<=hh) break; trey[cha*2]=trey[cha]; idy[trey[cha]]=cha*2; cha=con; con=cha/2; } idy[i]=cha; trey[cha]=i; } void downx(){ } void downy(int i){ int cha=i,con=cha*2,hh=a[trey[i]].y; while (con<=nny){ if (con<nny && a[trey[con]].y>a[trey[con+1]].y) con++; if (hh<=a[trey[con]].y) break; trey[cha]=trey[con]; idy[trey[con]]=cha; cha=con; con=cha*2; } idy[i]=cha; trey[cha]=i; } int popx(){ int i=trx[1]; trx[1]=trx[nnx]; idx[trx[nnx]]=1; idx[i]=0; nnx--; downx(); return i; } int popy(int i){ int j=trey[i]; trey[i]=trey[nny]; idy[trey[nny]]=i; nny--; downy(i); idy[j]=0; return j; } void Sort(int l,int r){ int hh=(rand() % (r-l+1))+l; int i=l,j=r; while (i<j){ while ( (a[hh].x>a[i].x)||(a[hh].x==a[i].x && a[i].y<a[hh].y)) i++; while ( (a[hh].x<a[j].x)||(a[hh].x==a[j].x && a[j].y>a[hh].y)) j--; if (i<=j){ swap(a[i],a[j]); i++; j--; } } if (i<r) Sort(i,r); if (j>l) Sort(l,j); } void process(int c){ int i=1,k,co; while (nny>0){ res++; k=a[popy(1)].y; co=1; while (co<c && i<n && a[i].x<=k){ co++; popy(idy[i]); i++; } } } void main(){ cin >> n >> c >> k; int i,j=-1,h; for (i=0;i<n;i++){ cin >> a[i].x; a[i].y=a[i].x+k; dau[i]=true; } Sort(0,n-1); for (i=0;i<n;i++) upy(i); process(c); cout << res; }
a.cc:105:1: error: '::main' must return 'int' 105 | void main(){ | ^~~~
s292682879
p03785
C++
#include <iostream> #include <stdlib.h> #include <utility> using namespace std; const int MaxN=100003; int n,c,k,res=0,nnx=0,nny=0,idx[MaxN],idy[MaxN]; bool dau[MaxN]; struct ta{ int x,y;}; ta a[MaxN]; ta b[2*MaxN],trx[8*MaxN],trey[8*MaxN]; void upx(int i){ if (idx[i]==0){ nnx++; idx[i]=nnx; trx[nnx]=i; } int cha=nnx,hh=a[i].x,con=cha/2; while (con>0){ if (a[trx[cha]].x<=hh) break; trx[cha*2]=trx[cha]; idx[trx[cha]]=cha*2; cha=con; con=cha/2; } idx[i]=cha; trx[cha]=i; } void upy(int i){ if (idy[i]==0){ nny++; idy[i]=nny; trey[nny]=i; } int cha=nny,hh=a[i].y,con=cha/2; while (con>0){ if (a[trey[cha]].x<=hh) break; trey[cha*2]=trey[cha]; idy[trey[cha]]=cha*2; cha=con; con=cha/2; } idy[i]=cha; trey[cha]=i; } void downx(){ } void downy(int i){ int cha=i,con=cha*2,hh=a[trey[i]].y; while (con<=nny){ if (con<nny && a[trey[con]].y>a[trey[con+1]].y) con++; if (hh<=a[trey[con]].y) break; trey[cha]=trey[con]; idy[trey[con]]=cha; cha=con; con=cha*2; } idy[i]=cha; trey[cha]=i; } int popx(){ int i=trx[1]; trx[1]=trx[nnx]; idx[trx[nnx]]=1; idx[i]=0; nnx--; downx(); return i; } int popy(int i){ int j=trey[i]; trey[i]=trey[nny]; idy[trey[nny]]=i; nny--; downy(i); idy[j]=0; return j; } void Sort(int l,int r){ int hh=(rand % (r-l+1))+l; int i=l,j=r; while (i<j){ while ( (a[hh].x>a[i].x)||(a[hh].x==a[i].x && a[i].y<a[hh].y)) i++; while ( (a[hh].x<a[j].x)||(a[hh].x==a[j].x && a[j].y>a[hh].y)) j--; if (i<=j){ swap(a[i],a[j]); i++; j--; } } if (i<r) Sort(i,r); if (j>l) Sort(l,j); } void process(int c){ int i=1,k,co; while (nny>0){ res++; k=a[popy(1)].y; co=1; while (co<c && i<n && a[i].x<=k){ co++; popy(idy[i]); i++; } } } void main(){ cin >> n >> c >> k; int i,j=-1,h; for (i=0;i<n;i++){ cin >> a[i].x; a[i].y=a[i].x+k; dau[i]=true; } Sort(0,n-1); for (i=0;i<n;i++) upy(i); process(c); cout << res; }
a.cc: In function 'void upx(int)': a.cc:16:18: error: no match for 'operator=' (operand types are 'ta' and 'int') 16 | trx[nnx]=i; | ^ a.cc:8:8: note: candidate: 'constexpr ta& ta::operator=(const ta&)' 8 | struct ta{ int x,y;}; | ^~ a.cc:8:8: note: no known conversion for argument 1 from 'int' to 'const ta&' a.cc:8:8: note: candidate: 'constexpr ta& ta::operator=(ta&&)' a.cc:8:8: note: no known conversion for argument 1 from 'int' to 'ta&&' a.cc:20:14: error: no match for 'operator[]' (operand types are 'ta [100003]' and 'ta') 20 | if (a[trx[cha]].x<=hh) break; | ^ a.cc:22:12: error: no match for 'operator[]' (operand types are 'int [100003]' and 'ta') 22 | idx[trx[cha]]=cha*2; | ^ a.cc:27:14: error: no match for 'operator=' (operand types are 'ta' and 'int') 27 | trx[cha]=i; | ^ a.cc:8:8: note: candidate: 'constexpr ta& ta::operator=(const ta&)' 8 | struct ta{ int x,y;}; | ^~ a.cc:8:8: note: no known conversion for argument 1 from 'int' to 'const ta&' a.cc:8:8: note: candidate: 'constexpr ta& ta::operator=(ta&&)' a.cc:8:8: note: no known conversion for argument 1 from 'int' to 'ta&&' a.cc: In function 'void upy(int)': a.cc:33:19: error: no match for 'operator=' (operand types are 'ta' and 'int') 33 | trey[nny]=i; | ^ a.cc:8:8: note: candidate: 'constexpr ta& ta::operator=(const ta&)' 8 | struct ta{ int x,y;}; | ^~ a.cc:8:8: note: no known conversion for argument 1 from 'int' to 'const ta&' a.cc:8:8: note: candidate: 'constexpr ta& ta::operator=(ta&&)' a.cc:8:8: note: no known conversion for argument 1 from 'int' to 'ta&&' a.cc:37:14: error: no match for 'operator[]' (operand types are 'ta [100003]' and 'ta') 37 | if (a[trey[cha]].x<=hh) break; | ^ a.cc:39:12: error: no match for 'operator[]' (operand types are 'int [100003]' and 'ta') 39 | idy[trey[cha]]=cha*2; | ^ a.cc:44:15: error: no match for 'operator=' (operand types are 'ta' and 'int') 44 | trey[cha]=i; | ^ a.cc:8:8: note: candidate: 'constexpr ta& ta::operator=(const ta&)' 8 | struct ta{ int x,y;}; | ^~ a.cc:8:8: note: no known conversion for argument 1 from 'int' to 'const ta&' a.cc:8:8: note: candidate: 'constexpr ta& ta::operator=(ta&&)' a.cc:8:8: note: no known conversion for argument 1 from 'int' to 'ta&&' a.cc: In function 'void downy(int)': a.cc:49:29: error: no match for 'operator[]' (operand types are 'ta [100003]' and 'ta') 49 | int cha=i,con=cha*2,hh=a[trey[i]].y; | ^ a.cc:51:25: error: no match for 'operator[]' (operand types are 'ta [100003]' and 'ta') 51 | if (con<nny && a[trey[con]].y>a[trey[con+1]].y) con++; | ^ a.cc:51:40: error: no match for 'operator[]' (operand types are 'ta [100003]' and 'ta') 51 | if (con<nny && a[trey[con]].y>a[trey[con+1]].y) con++; | ^ a.cc:52:18: error: no match for 'operator[]' (operand types are 'ta [100003]' and 'ta') 52 | if (hh<=a[trey[con]].y) break; | ^ a.cc:54:12: error: no match for 'operator[]' (operand types are 'int [100003]' and 'ta') 54 | idy[trey[con]]=cha; | ^ a.cc:59:15: error: no match for 'operator=' (operand types are 'ta' and 'int') 59 | trey[cha]=i; | ^ a.cc:8:8: note: candidate: 'constexpr ta& ta::operator=(const ta&)' 8 | struct ta{ int x,y;}; | ^~ a.cc:8:8: note: no known conversion for argument 1 from 'int' to 'const ta&' a.cc:8:8: note: candidate: 'constexpr ta& ta::operator=(ta&&)' a.cc:8:8: note: no known conversion for argument 1 from 'int' to 'ta&&' a.cc: In function 'int popx()': a.cc:62:16: error: cannot convert 'ta' to 'int' in initialization 62 | int i=trx[1]; | ~~~~~^ | | | ta a.cc:64:8: error: no match for 'operator[]' (operand types are 'int [100003]' and 'ta') 64 | idx[trx[nnx]]=1; | ^ a.cc: In function 'int popy(int)': a.cc:71:17: error: cannot convert 'ta' to 'int' in initialization 71 | int j=trey[i]; | ~~~~~~^ | | | ta a.cc:73:8: error: no match for 'operator[]' (operand types are 'int [100003]' and 'ta') 73 | idy[trey[nny]]=i; | ^ a.cc: In function 'void Sort(int, int)': a.cc:80:18: error: invalid operands of types 'int() noexcept' and 'int' to binary 'operator%' 80 | int hh=(rand % (r-l+1))+l; | ~~~~ ^ ~~~~~~~ | | | | | int | int() noexcept a.cc: At global scope: a.cc:105:1: error: '::main' must return 'int' 105 | void main(){ | ^~~~
s979610134
p03785
C++
#include <iostream> #include <stdlib.h> #include <utility> using namespace std; const int MaxN=100003; int n,c,k,res=0,nnx=0,nny=0; bool dau[MaxN]; struct ta{ int x,y;}; ta a[MaxN]; ta b[2*MaxN],trx[8*MaxN],idx[MaxN],idy[MaxN],trey[8*MaxN]; void upx(int i){ if (idx[i]==0){ nnx++; idx[i]=nnx; trx[nnx]=i; } int cha=nnx,hh=a[i].x,con=cha/2; while (con>0){ if (a[trx[cha]].x<=hh) break; trx[cha*2]=trx[cha]; idx[trx[cha]]=cha*2; cha=con; con=cha/2; } idx[i]=cha; trx[cha]=i; } void upy(int i){ if (idy[i]==0){ nny++; idy[i]=nny; trey[nny]=i; } int cha=nny,hh=a[i].y,con=cha/2; while (con>0){ if (a[trey[cha]].x<=hh) break; trey[cha*2]=trey[cha]; idy[trey[cha]]=cha*2; cha=con; con=cha/2; } idy[i]=cha; trey[cha]=i; } void downx(){ } void downy(int i){ int cha=i,con=cha*2,hh=a[trey[i]].y; while (con<=nny){ if (con<nny && a[trey[con]].y>a[trey[con+1]].y) con++; if (hh<=a[trey[con]].y) break; trey[cha]=trey[con]; idy[trey[con]]=cha; cha=con; con=cha*2; } idy[i]=cha; trey[cha]=i; } int popx(){ int i=trx[1]; trx[1]=trx[nnx]; idx[trx[nnx]]=1; idx[i]=0; nnx--; downx(); return i; } int popy(int i){ int j=trey[i]; trey[i]=trey[nny]; idy[trey[nny]]=i; nny--; downy(i); idy[j]=0; return j; } void Sort(int l,int r){ int hh=(rand % (r-l+1))+l; int i=l,j=r; while (i<j){ while ( (a[hh].x>a[i].x)||(a[hh].x==a[i].x && a[i].y<a[hh].y)) i++; while ( (a[hh].x<a[j].x)||(a[hh].x==a[j].x && a[j].y>a[hh].y)) j--; if (i<=j){ swap(a[i],a[j]); i++; j--; } } if (i<r) Sort(i,r); if (j>l) Sort(l,j); } void process(int c){ int i=1,k,co; while (nny>0){ res++; k=a[popy(1)].y; co=1; while (co<c && i<n && a[i].x<=k){ co++; popy(idy[i]); i++; } } } void main(){ cin >> n >> c >> k; int i,j=-1,h; for (i=0;i<n;i++){ cin >> a[i].x; a[i].y=a[i].x+k; dau[i]=true; } Sort(0,n-1); for (i=0;i<n;i++) upy(i); process(c); cout << res; }
a.cc: In function 'void upx(int)': a.cc:13:15: error: no match for 'operator==' (operand types are 'ta' and 'int') 13 | if (idx[i]==0){ | ~~~~~~^~~ | | | | ta int In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:13:17: note: 'ta' is not derived from 'const std::fpos<_StateT>' 13 | if (idx[i]==0){ | ^ In file included from /usr/include/c++/14/string:43, 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: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:13:17: note: 'ta' is not derived from 'const std::allocator<_CharT>' 13 | if (idx[i]==0){ | ^ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:13:17: note: 'ta' is not derived from 'const std::reverse_iterator<_Iterator>' 13 | if (idx[i]==0){ | ^ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:13:17: note: 'ta' is not derived from 'const std::reverse_iterator<_Iterator>' 13 | if (idx[i]==0){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:13:17: note: 'ta' is not derived from 'const std::move_iterator<_IteratorL>' 13 | if (idx[i]==0){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:13:17: note: 'ta' is not derived from 'const std::move_iterator<_IteratorL>' 13 | if (idx[i]==0){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:13:17: note: 'ta' is not derived from 'const std::pair<_T1, _T2>' 13 | if (idx[i]==0){ | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:13:17: note: 'ta' is not derived from 'std::basic_string_view<_CharT, _Traits>' 13 | if (idx[i]==0){ | ^ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:13:17: note: 'ta' is not derived from 'std::basic_string_view<_CharT, _Traits>' 13 | if (idx[i]==0){ | ^ /usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:13:17: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 13 | if (idx[i]==0){ | ^ /usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:13:17: note: 'ta' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 13 | if (idx[i]==0){ | ^ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:13:17: note: 'ta' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 13 | if (idx[i]==0){ | ^ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:13:17: note: mismatched types 'const _CharT*' and 'ta' 13 | if (idx[i]==0){ | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operator==(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed: a.cc:13:17: note: 'ta' is not derived from 'const std::tuple<_UTypes ...>' 13 | if (idx[i]==0){ | ^ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed: a.cc:13:17: note: 'ta' is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>' 13 | if (idx[i]==0){ | ^ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:449:3: note: candidate: 'bool std::operator==(const error_code&, const error_code&)' 449 | operator==(const error_code& __lhs, const error_code& __rhs) noexcept | ^~~~~~~~ /usr/include/c++/14/system_error:449:32: note: no known conversion for argument 1 from 'ta' to 'const std::error_code&' 449 | operator==(const error_code& __lhs, const error_code& __rhs) noexcept | ~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/system_error:465:3: note: candidate: 'bool std::operator==(const error_code&, const error_condition&)' 465 | operator==(const error_code& __lhs, const error_condition& __rhs) noexcept | ^~~~~~~~ /usr/include/c++/14/system_error:465:32: note: no known conversion for argument 1 from 'ta' to 'const std::error_code&' 465 | operator==(const error_code& __lhs, const error_condition& __rhs) noexcept | ~~~~~
s804201491
p03785
C++
#pragma comment(linker, "/STACK:1000000000") #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <string> #include <cstring> #include <queue> #include <deque> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <bitset> #include <memory> #include <cassert> #include <cstdlib> #include <cmath> #include <ctime> #include <stack> #define mp make_pair #define pb push_back typedef long long ll; typedef long double ld; using namespace std; const int MAXN = 200001; int a[MAXN]; int main() { ios_base::sync_with_stdio(0); int n, c, k; cin >> n >> c >> k; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int p = 0; int cur = 0; while (p < n) { cur++; p = min(p + c, upper_bound(a, a + n, a[p] + k) - a); } cout << cur << endl; return 0; }
a.cc: In function 'int main()': a.cc:47:24: error: no matching function for call to 'min(int, long int)' 47 | p = min(p + c, upper_bound(a, a + n, a[p] + k) - 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:3: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:47:24: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long int') 47 | p = min(p + c, upper_bound(a, a + n, a[p] + k) - a); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:6: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:47:24: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 47 | p = min(p + c, upper_bound(a, a + n, a[p] + k) - a); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s795929913
p03785
C
#include<stdio.h> int N,C,K,M; int T[100001]; int i,j,k,ans=0,max; int array[100001]; int can_ride(int Time); int main(void){ scanf("%d %d %d",&N,&C,&K); for(i=0;i<N;i++){ scanf("%d",&T[i]); } //puts("data seted."); //printf("%d\n",can_ride(4)); //printf("%d\n",array[0]); if(C<N){ while(C){ //printf("%d\n",i); max=T[0]; for(i=0;i<N;i++){ if(T[i]>max){ max = T[i]; } } for(j=1;j<max;j++){ if(can_ride(j) >= C){ //printf("%d\n",can_ride(4)); //printf("%d\n",array[0]); ans++; for(k=0;k<C;k++){ T[array[k]]=-1000000000; } } } C--; //printf("%d\n",C); } }else{ M=N while(M){ //printf("%d\n",i); max=T[0]; for(i=0;i<N;i++){ if(T[i]>max){ max = T[i]; } } for(j=1;j<max;j++){ if(can_ride(j) >= M){ //printf("%d\n",can_ride(4)); //printf("%d\n",array[0]); ans++; for(k=0;k<M;k++){ T[array[k]]=-1000000000; } } } M--; //printf("%d\n",C); } } printf("%d\n",ans); return 0; } int can_ride(int Time){ int count=0; for(i=0;i<N;i++){ if(T[i] <= Time && Time <= T[i]+K){ array[count]=i; count++; } } return count; }
main.c: In function 'main': main.c:43:6: error: expected ';' before 'while' 43 | M=N | ^ | ; 44 | while(M){ | ~~~~~
s304517349
p03785
C
#include<stdio.h> #include<stdlib.h> int int_sort(const void * a, const void * b) { return *(long int*)a - *(long int*)b; } int main() { long int N, C, K; long int *T; long int nBus; long int i,j; scanf("%d %d %d",&N,&C,&K); T = (long int *)malloc(sizeof(long int)*N); for (i = 0; i < N; i++) { scanf("%d", &T[i]); } qsort(T, N,sizeof(long int), int_sort); for (i = 0,nBus=1; i < N; i++) { for (j = 0; j < C; j++) { if(T[i] + K < T[i+j]) { break; } } i += j; nBus++; } prlong intf("%d\n", nBus); return 0; }
main.c: In function 'main': main.c:34:9: error: unknown type name 'prlong'; did you mean 'ulong'? 34 | prlong intf("%d\n", nBus); | ^~~~~~ | ulong main.c:34:21: error: expected declaration specifiers or '...' before string constant 34 | prlong intf("%d\n", nBus); | ^~~~~~ main.c:34:29: error: expected declaration specifiers or '...' before 'nBus' 34 | prlong intf("%d\n", nBus); | ^~~~
s632320126
p03785
C++
#include <stdio.h> int N; long long int C, K; long long int T[100001]; long long int a = 1; long long int b; long long int ans=0; bool flag; int main() { scanf_s("%d %lld %lld", &N, &C, &K); for (int i = 1; i <= N; i++) { scanf_s("%lld", &T[i]); } for (int i = 1; i <= N; i++) { for (int j = i + 1; j <= N; j++) { if (T[i] > T[j]) { b = T[j]; T[j] = T[i]; T[i] = b; } } } while (a <= N) { flag = false; for (int i = a; i <= a + C - 1; i++) { if (i + 1 <= N) { if (T[i] - T[a] <= K && T[i + 1] - T[a] > K) { a = i + 1; ans++; flag = true; break; } } } if (!flag) { a += C; ans++; } } printf("%lld\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:13:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 13 | scanf_s("%d %lld %lld", &N, &C, &K); | ^~~~~~~ | scanf
s002239235
p03785
C
#include<stdio.h> #include<stdlib.h> int main() { int N,C,K,B,P,s,F; int *T int i,j; scanf("%d %d %d",&N,&C,&K); T = (int *)malloc(N * sizeof(int)); B=0; P=0; for(i=0;i<N;i++){ scanf("%d",&T[i]); } for(i=0;i<N;i++){ for(j=N-1;j>i;j--){ if(T[j]<T[j-1]){ s=T[j]; T[j]=T[j-1]; T[j-1]=s; } } } F=T[0]; for(i=0;i<N;i++){ if(P<C){ P++; }else if(P==C || (T[i]-F)>K){ B++; P=1; F=T[i]; } } printf("%d",B); free(T); return 0; }
main.c: In function 'main': main.c:7:7: error: expected ';' before 'int' 7 | int *T | ^ | ; 8 | int i,j; | ~~~ main.c:11:1: error: 'T' undeclared (first use in this function) 11 | T = (int *)malloc(N * sizeof(int)); | ^ main.c:11:1: note: each undeclared identifier is reported only once for each function it appears in
s650135526
p03785
Java
import java.io.*; import java.util.*; import java.math.*; class Main { InputStream is; PrintWriter out; boolean possible(int[] A , int [] B , int x) { long current = A[x]; boolean f = true; int lim = (int)(1e9); for(int i = 1;i < A.length;i++) { if (B[i] == A[x]) { // out.println("same"); continue; } // out.println("checking " + B[i]); // out.println("with " + current); if (B[i] > 2 * current) return false; current += B[i]; if (current >= lim) return true; } return true; } void solve(){ //Enter code here int n = ni(); // out.println(n); int[] A = new int[n + 1]; int[] B = new int[n + 1]; for(int i = 1;i <= n;i++) { A[i] = ni(); B[i] = A[i]; } Arrays.sort(B , 1 , n + 1); // for(int i = 1;i <= n;i++) // out.println(B[i]); int ans = 0; for(int i = 1;i <= n;i++) { if (possible(A , B , i)) { ans++; } } out.println(ans); } public static void main(String[] args) { Solution play = new Solution(); play.run(); } void run(){ is = System.in; out = new PrintWriter(System.out); solve(); out.flush(); } byte input[] = new byte[1024]; int len = 0,ptr = 0; int readByte() { if(ptr >= len){ ptr = 0; try{ len = is.read(input); } catch(IOException e){ throw new InputMismatchException(); } if(len <= 0){ return -1; } } return input[ptr++]; } boolean isSpaceChar(int c) { return !( c >= 33 && c <= 126 ); } int skip(){ int b = readByte(); while(b != -1 && isSpaceChar(b)){ b = readByte(); } return b; } char nc() { return (char)skip(); } String ns() { int b = skip(); StringBuilder sb = new StringBuilder(); while(!isSpaceChar(b)){ sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } int ni() { int n = 0,b = readByte(); boolean minus = false; while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')){ b = readByte(); } if(b == '-'){ minus = true; b = readByte(); } while(b >= '0' && b <= '9'){ n = n * 10 + (b - '0'); b = readByte(); } return minus ? -n : n; } long nl() { long n = 0L; int b = readByte(); boolean minus = false; while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')){ b = readByte(); } if(b == '-'){ minus = true; b = readByte(); } while(b>='0' && b<='9'){ n = n * 10 + (b - '0'); b = readByte(); } return minus ? -n : n; } double nd() { return Double.parseDouble(ns()); } float nf() { return Float.parseFloat(ns()); } int[] na(int n){ int a[] = new int[n]; for(int i = 0;i < n;i++){ a[i] = ni(); } return a; } char[] ns(int n) { char c[] = new char[n]; int i , b = skip(); for (i = 0;i < n;i++){ if (isSpaceChar(b)){ break; } c[i] = (char)b; b = readByte(); } return i == n ? c : Arrays.copyOf(c , i); } }
Main.java:50: error: cannot find symbol Solution play = new Solution(); ^ symbol: class Solution location: class Main Main.java:50: error: cannot find symbol Solution play = new Solution(); ^ symbol: class Solution location: class Main 2 errors
s620816701
p03785
Java
public class Main { public static void main(String args[]){ Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int C = scan.nextInt(); int K = scan.nextInt(); int tempT = 0; int tempC = 0; int tempB = 0; int Ti = 0; Ti = scan.nextInt(); tempT = Ti + K; tempC = 1; tempB = 1; while (scan.hasNext()) { Ti = scan.nextInt(); if (tempC <= C && Ti <= tempT){ tempC++; } else { tempB++; tempC = 1; tempT = Ti + K; } } System.out.println(tempB); } }
Main.java:3: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s829208395
p03785
C++
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int N = Integer.valueOf(in.nextInt()); // Number of passengers long C = Long.valueOf(in.nextLong()); // Size of bus long K = Long.valueOf(in.nextLong()); // Max wait time long[] T = new long[N]; // Arrival timings for (int x = 0; x < N; x++) { T[x] = in.nextLong(); } int Ti = 0; // Current passenger int buses = 1; while (Ti != N){ // UpperBound = T + K for (int x = Ti; x <= Ti + C; x++) { if (x == Ti + C || T[x] > T[Ti] + K) { buses++; Ti = x; break; } } } System.out.println(buses); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s485726467
p03785
C++
import java.util.Scanner; public class AtCoder_GrandContest11_1 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int N = Integer.valueOf(in.nextInt()); // Number of passengers long C = Long.valueOf(in.nextLong()); // Size of bus long K = Long.valueOf(in.nextLong()); // Max wait time long[] T = new long[N]; // Arrival timings for (int x = 0; x < N; x++) { T[x] = in.nextLong(); } int Ti = 0; // Current passenger int buses = 1; while (Ti != N){ // UpperBound = T + K for (int x = Ti; x <= Ti + C; x++) { if (x == Ti + C || T[x] > T[Ti] + K) { buses++; Ti = x; break; } } } System.out.println(buses); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class AtCoder_GrandContest11_1 { | ^~~~~~
s397537455
p03785
Java
public class Main { public static void main(String args[]){ Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int C = scan.nextInt(); int K = scan.nextInt(); int tempT = 0; int tempC = 0; int tempB = 0; int Ti = 0; while (scan.hasNext()) { Ti = scan.nextInt(); if (tempC < C && Ti < tempT){ tempC++; } else { tempB++; tempC = 1; tempT = Ti + K; } } System.out.println(tempB); } }
Main.java:3: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s162164540
p03785
C
#include<stdio.h> #include<stdlib.h> int main() { int N,C,K,B,P,S,F; int *T; int i,j; scanf("%d %d %d",&N,&C,&K); T = (int *)malloc(N * sizeof(int)); B=0; for(i=0;i<N;i++){ scanf("%d",&T[i]); } for(i=0;i<N;i++){ for(j=N-1;j>i;j--){ if(T[j]<T[j-1]){ s=T[j]; T[j]=T[j-1]; T[j-1]=s; } } } F=T[0]; for(i=0;i<N;i++){ if(P<C){ P++; }else if(P==C || (T[i]-F)>K){ B++; P=1; F=T[i]; } } printf("%d",B); free(T); return 0; }
main.c: In function 'main': main.c:22:1: error: 's' undeclared (first use in this function) 22 | s=T[j]; | ^ main.c:22:1: note: each undeclared identifier is reported only once for each function it appears in
s517383028
p03785
C++
#include<stdio.h> #include<stdlib.h> #include<algorithm> /* ソート関数 */ int int_sort(const void * a, const void * b) { /* 引数はvoid*型と規定されているのでint型にcastする */ if (*(int *)a < *(int *)b) { return -1; } else if (*(int *)a == *(int *)b) { return 0; } return 1; } int main() { int N, C, K; int *T; int nBus; int i,j; scanf("%d %d %d",&N,&C,&K); T = (int *)malloc(sizeof(int)*N); for (int i = 0; i < N; i++) { scanf_s("%d", &T[i]); } qsort(T, N,sizeof(int),int_sort); for (i = 0,nBus=1; i < N; i++) { for (j = 0; j < C; j++) { if(T[i] + K < T[i+j]) { break; } } i += j; nBus++; } printf("%d\n", nBus); return 0; }
a.cc: In function 'int main()': a.cc:29:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 29 | scanf_s("%d", &T[i]); | ^~~~~~~ | scanf
s797672699
p03785
C++
#include<stdio.h> #include<stdlib.h> #include<algorithm> /* ソート関数 */ int int_sort(const void * a, const void * b) { /* 引数はvoid*型と規定されているのでint型にcastする */ if (*(int *)a < *(int *)b) { return -1; } else if (*(int *)a == *(int *)b) { return 0; } return 1; } int main() { int N, C, K; int *T; int nBus; int i,j; scanf("%d %d %d",&N,&C,&K); T = (int *)malloc(sizeof(int)*N); for (int i = 0; i < N; i++) { scanf_s("%d", &T[i]); } qsort(T, N,sizeof(int),int_sort); for (i = 0,nBus=1; i < N; i++) { for (j = 0; j < C; j++) { if(T[i] + K < T[i+j]) { break; } } i += j; nBus++; } printf("%d\n", nBus); return 0; }
a.cc: In function 'int main()': a.cc:29:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 29 | scanf_s("%d", &T[i]); | ^~~~~~~ | scanf
s851316233
p03785
C++
#include<stdio.h> #include<stdlib.h> #include<algorithm> /* ソート関数 */ int int_sort(const void * a, const void * b) { /* 引数はvoid*型と規定されているのでint型にcastする */ if (*(int *)a < *(int *)b) { return -1; } else if (*(int *)a == *(int *)b) { return 0; } return 1; } int main() { int N, C, K; int *T; int nBus; int i,j; scanf_s("%d %d %d",&N,&C,&K); T = (int *)malloc(sizeof(int)*N); for (int i = 0; i < N; i++) { scanf_s("%d", &T[i]); } qsort(T, N,sizeof(int),int_sort); for (i = 0,nBus=1; i < N; i++) { for (j = 0; j < C; j++) { if(T[i] + K < T[i+j]) { break; } } i += j; nBus++; } printf("%d\n", nBus); return 0; }
a.cc: In function 'int main()': a.cc:24:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 24 | scanf_s("%d %d %d",&N,&C,&K); | ^~~~~~~ | scanf
s200501024
p03785
C++
// ConsoleApplication2.cpp : コンソール アプリケーションのエントリ ポイントを定義します。 // #include "stdafx.h" #include <iostream> #include <algorithm> int n, c, k, t[100005], tf, ans, cnt; int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); std::cin >> n >> c >> k; for (int i = 0; i < n; ++i) std::cin >> t[i]; std::sort(t, t + n); for (int i = 0; i < n; ++i) { //std::cout << "pre :" << ans << " " << cnt << std::endl; if (tf == 0) { tf = t[i]; cnt++; } else { if (t[i] <= tf + k && cnt < c) { cnt++; if (i == n - 1) { ans++; } } else if (t[i] > tf + k || cnt >= c) { ans++; tf = t[i]; cnt = 1; if (i == n - 1) ans++; } } //std::cout << ans << " " << cnt << std::endl; } std::cout << ans << std::endl; return 0; }
a.cc:4:10: fatal error: stdafx.h: No such file or directory 4 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s397782457
p03785
Java
mport java.util.Arrays; import java.util.Scanner; public class Main { /** * @param args */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int C = sc.nextInt(); int K = sc.nextInt(); int[] T = new int[N]; for (int i=0; i<N; i++) { T[i] = sc.nextInt(); } System.out.println(solve(N, C, K, T)); } private static int solve(int N, int C, int K, int[] T) { int count = 0; Arrays.sort(T); int idx = 0; int sum = 0; for (int i=0; i<N; i++) { if (T[i] - idx > K) { count++; idx = T[i]; sum = 1; } else if (sum+1 > C) { count++; idx = T[i]; sum = 1; } else { sum++; } } if (sum > 0) { count++; } return count; } }
Main.java:1: error: class, interface, enum, or record expected mport java.util.Arrays; ^ Main.java:2: error: class, interface, enum, or record expected import java.util.Scanner; ^ 2 errors
s088281690
p03785
Java
public class Main { private static int solve(int n, int c, int k, int[] ts) { int count = 0; int r = 0; int maxT = -1; for (int t : ts) { if (maxT == -1) { maxT = t + k; } if (maxT >= t && count < c) { count++; } else { r++; count = 1; maxT = t + k; } } if (count > 0) { r++; } return r; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int c = in.nextInt(); int k = in.nextInt(); int[] ts = new int[n]; for (int i = 0; i < n; i++) { ts[i] = in.nextInt(); } Arrays.sort(ts); System.out.println(solve(n, c, k, ts)); } }
Main.java:27: error: cannot find symbol Scanner in = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:27: error: cannot find symbol Scanner in = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:35: error: cannot find symbol Arrays.sort(ts); ^ symbol: variable Arrays location: class Main 3 errors
s141587418
p03785
C++
#include <iostream> #include <sstream> #include <algorithm> #include <numeric> #include <functional> #include <iterator> #include <bitset> #include <string> #include <list> #include <vector> #include <stack> #include <queue> #include <set> #include <map> typedef signed long long int slli; typedef unsigned long long int ulli; const slli MAX_SLLI = 0x7FFFFFFFFFFFFFFF; const slli MIN_SLLI = 0x8000000000000000; const ulli MAX_ULLI = 0xFFFFFFFFFFFFFFFF; const ulli MIN_ULLI = 0x0000000000000000; #define N_TIMES(i, n) for (ulli i = 0; i < n; ++i) #define N_TIMES_REV(i, n) for (slli i = n - 1; i >= 0; --i) #ifdef __DEBUG__ template<typename T> std::ostream& operator<<(std::ostream &os, const std::list<T> &list) { const std::string delim = ", "; typename std::list<T>::const_iterator itr = list.begin(); while (itr != list.end()) { os << *itr; ++itr; if(itr != list.end()) os << delim; } return os; } template<typename T> std::ostream& operator<<(std::ostream &os, const std::vector<T> &v) { const std::string delim = ", "; for (unsigned n = 0; n < v.size(); ++n) { os << v[n]; if((n + 1) < v.size()) os << delim; } return os; } #endif int main() { unsigned N, C, K; std::cin >> N >> C >> K; std::vector<unsigned> T(N); N_TIMES(n, N) std::cin >> T[n]; std::sort(T.begin(), T.end()); std::cerr << T << std::endl; unsigned max = T[0] + K, count = 0, bus = 0; N_TIMES(n, N) { if (T[n] <= max) { ++count; } else { ++bus; max = T[n] + K; count = 1; } if (count == C) { ++bus; max = T[n + 1] + K; count = 0; } } if (count > 0) ++bus; std::cout << bus << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:61:13: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<unsigned int>') 61 | std::cerr << T << std::endl; | ~~~~~~~~~ ^~ ~ | | | | | std::vector<unsigned int> | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]' 306 | operator<<(nullptr_t) | ^~~~~~~~ /usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from 'std::vector<unsigned int>' to 'std::nullptr_t' 306 | operator<<(nullptr_t) | ^~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:12
s272168982
p03785
C++
#include <bits\stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); long long n, c, k; cin >> n >> c >> k; vector<long long> t(n); for (auto &a : t) { cin >> a; } sort(t.begin(), t.end()); int ans = 1; int time = t[0] + k; int count = 1; for (long long i = 0; i < n; i++) { if (count >= c) { ans++; time = t[min(i + 1,n-1)] + k; count = 0; } if (time <= t[i]) { ans++; time = t[i] + k; count = 1; } count++; } cout << ans << endl; return 0; }
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory 1 | #include <bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s441025310
p03785
C++
#include "bits\stdc++.h" using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); long long n, c, k; cin >> n >> c >> k; vector<long long> t(n); for (auto &a : t) { cin >> a; } sort(t.begin(), t.end()); int ans = 1; int time = t[0] + k; int count = 1; for (long long i = 0; i < n; i++) { if (count >= c) { ans++; time = t[min(i + 1,n-1)] + k; count = 0; } if (time <= t[i]) { ans++; time = t[i] + k; count = 1; } count++; } cout << ans << endl; return 0; }
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory 1 | #include "bits\stdc++.h" | ^~~~~~~~~~~~~~~ compilation terminated.
s567289558
p03785
C++
N,C,K = map(int,input().split()) A = [] for n in range(N): a = int(input()) A.append(a) A.sort() b = 0 for a in A: if b == 0: b = 1 c = 1 t = a elif c >= C: b = b + 1 c = 1 t = a elif a <= t + K and c < C: c = c + 1 elif a > t + K: b = b + 1 c = 1 t = a print(b)
a.cc:1:1: error: 'N' does not name a type 1 | N,C,K = map(int,input().split()) | ^
s145070760
p03785
C++
n,c,k = map(int, input().split()) t = [] for i in range(n): t.append(int(input())) t.sort() ni,nt,ans = 0,0,0 while 1: if ni >= n: break nt = t[ni] for i in range(1,c+1): if ni+i<n and t[ni+i] < nt + k: ni += 1 else: break ni += 1 ans += 1 print(ans)
a.cc:1:1: error: 'n' does not name a type 1 | n,c,k = map(int, input().split()) | ^
s088091901
p03785
Java
import java.util.*; public class A{ static Scanner s = new Scanner(System.in); public static void main(String[] args) { int n=s.nextInt(),c=s.nextInt(),k=s.nextInt(); boolean[] t = new boolean[1000001]; for(int i=0;i<n;i++) t[s.nextInt()]=true; int result=0,bus; for(int i=0;i<t.length;i++) { if(t[i]) { result++; bus=0; for(int j=0;j<=k;j++) { if(t[i+j]) { bus++; t[i+j]=false; } if(bus==c) break; } } } System.out.println(result); } }
Main.java:2: error: class A is public, should be declared in a file named A.java public class A{ ^ 1 error
s148925121
p03785
C++
#include <iostream> #include <cstdio> #include <cstring> #include <vector> #include <set> using namespace std; const int MAXN=200001; int arr[MAXN]; int main(){ set<int> st; int n,c,k; cin>>n>>c>>k; for(int i=1;i<=n;i++)cin>>arr[i]; sort(arr+1,arr+n+1); int ret=0; for(int i=1;i<=n;i++){ if(st.size()==0){ st.insert(arr[i]); ret++; } else{ if(*st.begin()+k>=arr[i] && st.size()<c){ st.insert(arr[i]); }else{ st.clear(); st.insert(arr[i]); ret++; } } } cout<<ret; return 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(arr+1,arr+n+1); | ^~~~ | short
s963585559
p03785
C++
#include <iostream> #include <algorithm> using namespace std; int main() { int n, c, k; cin >> n >> c >> k; vector<int> v(n); for (int i = 0; i < n; ++i) { cin >> v[i]; } sort(v.begin(), v.end()); int j = 0; int ans = 0; for (int i = 0; i < n; ++i) { if (i - j + 1 > c || v[i] - v[j] > k) { j = i; ++ans; } } ++ans; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:5: error: 'vector' was not declared in this scope 10 | vector<int> v(n); | ^~~~~~ a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 2 | #include <algorithm> +++ |+#include <vector> 3 | a.cc:10:12: error: expected primary-expression before 'int' 10 | vector<int> v(n); | ^~~ a.cc:12:16: error: 'v' was not declared in this scope 12 | cin >> v[i]; | ^ a.cc:14:10: error: 'v' was not declared in this scope 14 | sort(v.begin(), v.end()); | ^
s623271966
p03785
C++
// // main.cpp // A // // Created by 黄宇凡 on 2017/3/12. // Copyright © 2017年 黄宇凡. All rights reserved. // #include <iostream> #include <cstdio> #include <cstring> #include <iostream> using namespace std; const int maxn = 1e5 + 5; long long T[maxn]; long long K,C; int n; int main(int argc, const char * argv[]) { cin >> n; cin >> C >> K; for(int i = 1;i <= n;i++){ int t; scanf("%d",&t); T[i] = t; } sort(T + 1,T + 1 + n); int num = 0; long long s; for(int i = 1,j = 1;i <= n;i = j + 1,j = i){ s = T[i] + K; while(j < n && j - i + 1 < C && T[j + 1] <= s){ j++; } num++; } cout << num << endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:30:5: error: 'sort' was not declared in this scope; did you mean 'short'? 30 | sort(T + 1,T + 1 + n); | ^~~~ | short
s641795416
p03785
C++
#include<iostream> #include<cstdio> #include<string> #include<algorithm> #include<vector> #include<list> #include<map> #include<set> #include<unordered_map> #include<unordered_set> using namespace std; int d[100000]; signed main() { int a, b, c; scanf("%d%d%d", &a, &b, &c); for (int e = 0; e < a; e++) { scanf("%d", &d[e]); } sort(d, d + a); int sum = 0, hito = 0, hazime =INT_MIN; for (int i = 0; i < a; i++) { if (hazime < d[i]-c) { sum++; hazime = d[i]; hito = 1; } else if (hito == b) { sum++; hazime = d[i]; hito = 1; } else { hito++; } } printf("%d\n", sum); }
a.cc: In function 'int main()': a.cc:20:40: error: 'INT_MIN' was not declared in this scope 20 | int sum = 0, hito = 0, hazime =INT_MIN; | ^~~~~~~ a.cc:11:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 10 | #include<unordered_set> +++ |+#include <climits> 11 | using namespace std;
s951960385
p03785
C++
use std::io::{self, Stdin}; use std::str::{self, FromStr}; use std::error::Error; fn exec() { let mut sc = Scanner::new(); let (n, c, k): (usize, usize, i64) = (sc.ne(), sc.ne(), sc.ne()); let mut t: Vec<i64> = (0..n).map(|_| sc.ne()).collect(); t.sort(); let mut ans = 0; let mut cnt = 0; let mut bus = -1; for i in 0..n { if bus == -1 { bus = t[i] + k; cnt = 1; ans += 1; } else { if cnt == c || bus < t[i] { bus = t[i] + k; cnt = 1; ans += 1; } else { cnt += 1; } } } println!("{}", ans); } fn main() { const STACK: usize = 16 * 1024 * 1024; let _ = std::thread::Builder::new() .stack_size(STACK) .spawn(|| { exec(); }) .unwrap() .join() .unwrap(); } #[allow(dead_code)] struct Scanner { stdin: Stdin, id: usize, buf: Vec<u8>, } #[allow(dead_code)] impl Scanner { fn new() -> Scanner { Scanner { stdin: io::stdin(), id: 0, buf: Vec::new(), } } fn next_line(&mut self) -> Option<String> { let mut res = String::new(); match self.stdin.read_line(&mut res) { Ok(0) => None, Ok(_) => Some(res), Err(why) => panic!("error in read_line: {}", why.description()), } } fn next<T: FromStr>(&mut self) -> Option<T> { while self.buf.len() == 0 { self.buf = match self.next_line() { Some(r) => { self.id = 0; r.trim().as_bytes().to_owned() } None => return None, }; } let l = self.id; assert!(self.buf[l] != b' '); let n = self.buf.len(); let mut r = l; while r < n && self.buf[r] != b' ' { r += 1; } let res = match str::from_utf8(&self.buf[l..r]).ok().unwrap().parse::<T>() { Ok(s) => Some(s), Err(_) => { panic!("parse error, {:?}", String::from_utf8(self.buf[l..r].to_owned())) } }; while r < n && self.buf[r] == b' ' { r += 1; } if r == n { self.buf.clear(); } else { self.id = r; } res } fn ne<T: FromStr>(&mut self) -> T { self.next::<T>().unwrap() } }
a.cc:8:28: error: too many decimal points in number 8 | let mut t: Vec<i64> = (0..n).map(|_| sc.ne()).collect(); | ^~~~ a.cc:13:14: error: too many decimal points in number 13 | for i in 0..n { | ^~~~ a.cc:41:2: error: invalid preprocessing directive #[ 41 | #[allow(dead_code)] | ^ a.cc:48:2: error: invalid preprocessing directive #[ 48 | #[allow(dead_code)] | ^ a.cc:1:1: error: 'use' does not name a type 1 | use std::io::{self, Stdin}; | ^~~ a.cc:2:1: error: 'use' does not name a type 2 | use std::str::{self, FromStr}; | ^~~ a.cc:3:1: error: 'use' does not name a type 3 | use std::error::Error; | ^~~ a.cc:5:1: error: 'fn' does not name a type 5 | fn exec() { | ^~ a.cc:31:1: error: 'fn' does not name a type 31 | fn main() { | ^~ a.cc:43:5: error: 'stdin' does not name a type 43 | stdin: Stdin, | ^~~~~ a.cc:1:1: note: 'stdin' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | use std::io::{self, Stdin}; a.cc:49:6: error: expected initializer before 'Scanner' 49 | impl Scanner { | ^~~~~~~
s189934489
p03785
C++
//#include <bits/stdc++.h> #include <iostream> using namespace std; typedef long long ll; ll n,c,k,a[111111],cnt,last,ans; int main() { cin>>n>>c>>k; for(ll i=1;i<=n;i++) scanf("%lld",&a[i]); sort(a+1,a+n+1); for(ll i=1;i<=n;i++) { if(cnt==0||a[i]-last>k) cnt=c,last=a[i],ans++; cnt--; } cout<<ans; }
a.cc: In function 'int main()': a.cc:11:9: error: 'sort' was not declared in this scope; did you mean 'short'? 11 | sort(a+1,a+n+1); | ^~~~ | short
s502959418
p03786
C++
#include <bits/stdc++.h> using namespace std; #include <math.h> #include <iomanip> 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; } const int64_t INF=1e18+1; const int mod = 1000000007; int main() { int N; cin>>N; vector<int>A(N); vector<int64_t>sum(N); for(int i=0;i<N;i++){ cin>>A[i]; } sort(A.begin(),A.end()); sum=A; for(int i=0;i<N-1;i++){ sum[i+1]+=sum[i]; } for(int i=N-2;i>=0;i--){ if(sum[i]*2<A[i+1]){cout<<N-1-i<<endl;return 0;} } cout<<N<<endl; return 0; }
a.cc: In function 'int main()': a.cc:19:7: error: no match for 'operator=' (operand types are 'std::vector<long int>' and 'std::vector<int>') 19 | sum=A; | ^ 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 = long int; _Alloc = std::allocator<long int>]' 210 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<long 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 = long int; _Alloc = std::allocator<long 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<int>' to 'std::vector<long 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 = long int; _Alloc = std::allocator<long 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<int>' to 'std::initializer_list<long int>' 788 | operator=(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
s877727250
p03786
C++
#include <its//stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long int ll; int main() { int n,cnt = 0; cin >> n; vector<int> a(n); rep(i, n) cin >> a[i]; sort(a.begin(), a.end()); ll sum = 0; rep(i, n - 1) { sum += a[i]; if (sum * 2 < a[i + 1]) cnt = i+1; }cout << n - cnt << endl; }
a.cc:1:10: fatal error: its//stdc++.h: No such file or directory 1 | #include <its//stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s051037864
p03786
C++
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #include <queue> #include <deque> #include <list> #include <set> #include <functional> #include <cmath> #include <numeric> #include <iomanip> #define REP(i,n) for(lint i{}, i##_len=(n); i<i##_len; ++i) #define DREP(i, h, j, w) for(lint i{}; i < (lint)(h); ++i)for(lint j{}; j < (lint)(w); ++j) #define DREP2(i, j, n) for(lint i{}; i < (lint)(n - 1); ++i)for(lint j{i + 1}; j < (lint)(n); ++j) #define SZ(x) ((lint)(x).size()) using lint = long long; lint N, M, H, W; using namespace std; const long long INF{ 1LL << 60 }; const long double PI{ 3.1415926535897932 }; const long long NUM97{ 1000000007 }; //動的計画法 template<class T> inline bool chmax(T& x, T y) { if (x < y) { x = y; return 1; } return 0; } template<class T> inline bool chmin(T& x, T y) { if (x > y) { x = y; return 1; } return 0; } std::vector<std::string> field; std::vector<std::vector<bool>> seen(H, std::vector<bool>(W)); //マス上の操作ハンドル(0 < i < 4)でループ回して用いる。 const std::vector<int> dx{ 1, 0, -1, 0 }; const std::vector<int> dy{ 0, 1, 0, -1 }; //0で埋める等々 void fill_example() { lint i{ 123 }; std::cout << std::setfill('0') << std::setw(6) << i << std::endl; } //pair型vectorの整列。sortの第三因数に指定して用いる。 bool first_smaller(std::pair<lint, lint>& a, std::pair<lint, lint>& b) { if (a.first != b.first) return{ a.first < b.first }; else return { a.second < b.second }; } bool first_larger(std::pair<lint, lint>& a, std::pair<lint, lint>& b) { if (a.first != b.first) return{ a.first > b.first }; else return { a.second > b.second }; } bool second_smaller(std::pair<lint, lint>& a, std::pair<lint, lint>& b) { if (a.second != b.second) return{ a.second < b.second }; else return { a.first < b.first }; } bool second_larger(std::pair<lint, lint>& a, std::pair<lint, lint>& b) { if (a.second != b.second) return{ a.second > b.second }; else return { a.first > b.first }; } //素数判定 bool is_prime(lint N) { if (N == 1) return false; for (lint i = 2; i * i <= N; ++i) { if (N % i == 0) return false; } return true; } //char&string → int lint toInt(char c) { return (lint)(c - '0'); } lint StoInt(std::string s) { lint num{}; for (int i = 0; i < s.size(); ++i) { if (i > 0) num *= 10; num += (lint)(s[i] - '0');} return num; } //桁数取得 lint get_digit(lint n) { return log10(n) + 1; } //階乗 lint factorial(lint n) { lint sum = 1; for (int i = 1; i <= n; ++i) sum *= i; return sum; } //組み合わせの数 lint combination(lint a, lint b) { lint ans{ 1 }, ta{ std::max(a, b) }, tb{ std::min(a, b) }; while (ta > std::abs(a - b)) { ans *= ta; --ta; } while (tb > 0) { ans /= tb; --tb; } return ans; } //約数カウント lint count_divisors(lint N) { lint count{}; for (lint i = 1; i * i <= N; ++i) { if (N % i == 0) { ++count; if (N / i != i) ++count; } } return count; } lint count_prime_divisors(lint N) { lint count{}; for (lint i = 1; i * i <= N; ++i) { if (N % i == 0) { if (is_prime(i)) ++count; if (N / i != i) { if (is_prime(N / i)) ++count; } } } return count; } //約数列挙 std::vector<lint> divisors(lint N) { std::vector<lint> divisor; for (lint i = 1; i * i <= N; ++i) { if (N % i == 0) { divisor.push_back(i); if (N / i != i) divisor.push_back(N / i); } } std::sort(divisor.begin(), divisor.end()); divisor.erase(std::unique(divisor.begin(), divisor.end()), divisor.end()); return divisor; } //素因数列挙 std::vector<lint> prime_divisors(lint N) { std::vector<lint> p_divisor; for (lint i{ 1 }; i * i <= N; ++i) { if (N % i == 0) { if (is_prime(i)) { p_divisor.push_back(i); } if (N / i != i) { if (is_prime(N / i)) { p_divisor.push_back(N / i); } } } } std::sort(p_divisor.begin(), p_divisor.end()); p_divisor.erase(std::unique(p_divisor.begin(), p_divisor.end()), p_divisor.end()); return p_divisor; } //素因数分解(first: 素因数, second: 各要素の数) std::vector<std::pair<lint, lint>> prime_factorize(lint N) { vector<pair<lint, lint>> factorize; for (lint a{ 2 }; a * a <= N; ++a) { if (N % a != 0) continue; lint ex{ 0 }; while (N % a == 0) { ++ex; N /= a; } factorize.push_back({ a, ex }); } if (N != 1) factorize.push_back({ N, 1 }); return factorize; } //DIVIDE void divide(lint N, lint& a, lint& b) { if (N % 2 == 1) { a = N / 2 + 1; b = N / 2; } else { a = N / 2; b = N / 2; } } /*====================I="LOVE"=MR=STROUSTRUP======================*/ /*===========================TEMPLATES============================*/ /*=============cin.tie(0),ios::sync_with_stdio(false);============*/ int main() { lint N; cin >> N; vector<lint> A(N); for (auto& r : A) cin >> r; std::sort(A.begin(), A.end()); lint count = 0, total = 0,c = 0; for (int i = 0; i < N - 1; ++i) { total += A[i]; if ((total * 2) <= A[i + 1]) ++count; if((total * 2) == A[i + 1]) ++c } cout << N - count - c/2; return 0; }
a.cc: In function 'int main()': a.cc:144:16: error: expected ';' before '}' token 144 | ++c | ^ | ; 145 | } | ~
s782077723
p03786
C++
#include<bits/stdc++.h> #include<atcoder/all> using namespace std; using namespace atcoder; /******* All Required define Pre-Processors and typedef Constants *******/ #define rep(i,n) for(int i=0; i<(n); ++i) #define rep2(i,a,b) for(int i=a; i<=(b); ++i) #define rep3(i,a,b) for(int i=a; i>=(b); --i) #define all(cont) cont.begin(), cont.end() #define rall(cont) cont.rbegin(), cont.rend() #define Dcout(a) cout << setprecision(20) << a << endl #define ll long long #define ld long double #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define eb emplace_back #define vi vector<int> #define vll vector<ll> #define vpi vector<pii> #define vpll vector<pll> #define fi first #define se second using Graph = vector<vector<ll>>; const ll INF64 = (1LL << 60); const int INF = 1 << 29; const double pi=acos(-1.0); /********************************** debug *************************************/ void __print(int x) {cerr << x;} void __print(long x) {cerr << x;} void __print(long long x) {cerr << x;} void __print(unsigned x) {cerr << x;} void __print(unsigned long x) {cerr << x;} void __print(unsigned long long x) {cerr << x;} void __print(float x) {cerr << x;} void __print(double x) {cerr << x;} void __print(long double x) {cerr << x;} void __print(char x) {cerr << '\'' << x << '\'';} void __print(const char *x) {cerr << '\"' << x << '\"';} void __print(const string &x) {cerr << '\"' << x << '\"';} void __print(bool x) {cerr << (x ? "true" : "false");} template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';} template<typename T> void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";} template <typename T, typename... V> void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);} #ifndef ONLINE_JUDGE #define debug(x...) cerr << "[" << #x << "] = ["; _print(x) #else #define debug(x...) #endif /****** Template of some basic operations *****/ struct IoSetup { IoSetup() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup; template< typename T1, typename T2 > ostream &operator<<(ostream &os, const pair< T1, T2 >& p) { os << p.first << " " << p.second; return os; } template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; } template< typename T > ostream &operator<<(ostream &os, const vector< T > &v) { for(int i = 0; i < (int) v.size(); i++) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; } template< typename T > istream &operator>>(istream &is, vector< T > &v) { for(T &in : v) is >> in; return is; } template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); } template< typename T = ll > vector< T > make_v(size_t a) { return vector< T >(a); } template< typename T, typename... Ts > auto make_v(size_t a, Ts... ts) { return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...)); } template< typename T, typename V > typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) { t = v; } template< typename T, typename V > typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e, v); } template< typename F > struct FixPoint : F { FixPoint(F &&f) : F(forward< F >(f)) {} template< typename... Args > decltype(auto) operator()(Args &&... args) const { return F::operator()(*this, forward< Args >(args)...); } }; template< typename F > inline decltype(auto) MFP(F &&f) { return FixPoint< F >{forward< F >(f)}; } /*********************************************************************/ /*****************++++++*** Start coding ! ***************************/ int main(){ int n; cin >> n; vector<ll> a(n); rep(i,n) cin >> a[i]; sort(all(a)); vector<ll> s(n+1); s[0] = a[0]; for(int i=1; i<n; i++) s[i] = s[i-1] + a[i]; int ans = 0; int cnt = 0; rep(i,n-1){ if(s[i]*2>=a[i+1]) { cnt++; }else{ cnt = 0; } } ans = cnt + 1; cout << ans << endl; } /******************************** end ********************************/
a.cc:2:9: fatal error: atcoder/all: No such file or directory 2 | #include<atcoder/all> | ^~~~~~~~~~~~~ compilation terminated.
s027755447
p03786
Java
import java.util.*; import java.io.*; import java.math.*; public class Main{ //Don't have to see. start------------------------------------------ static class InputIterator{ ArrayList<String> inputLine = new ArrayList<String>(1024); int index = 0; int max; String read; InputIterator(){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try{ while((read = br.readLine()) != null){ inputLine.add(read); } }catch(IOException e){} max = inputLine.size(); } boolean hasNext(){return (index < max);} String next(){ if(hasNext()){ return inputLine.get(index++); }else{ throw new IndexOutOfBoundsException("There is no more input"); } } } static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>(); static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem. static PrintWriter out = new PrintWriter(System.out); static void flush(){out.flush();} static void myout(Object t){out.println(t);} static void myerr(Object t){System.err.print("debug:");System.err.println(t);} static String next(){return ii.next();} static boolean hasNext(){return ii.hasNext();} static int nextInt(){return Integer.parseInt(next());} static long nextLong(){return Long.parseLong(next());} static double nextDouble(){return Double.parseDouble(next());} static ArrayList<String> nextStrArray(){return myconv(next(), 8);} static ArrayList<String> nextCharArray(){return myconv(next(), 0);} static ArrayList<Integer> nextIntArray(){ ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size()); for(int i = 0; i < input.size(); i++){ ret.add(Integer.parseInt(input.get(i))); } return ret; } static ArrayList<Long> nextLongArray(){ ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size()); for(int i = 0; i < input.size(); i++){ ret.add(Long.parseLong(input.get(i))); } return ret; } static String myconv(Object list, int no){//only join String joinString = CONVSTR.get(no); if(list instanceof String[]){ return String.join(joinString, (String[])list); }else if(list instanceof ArrayList){ return String.join(joinString, (ArrayList)list); }else{ throw new ClassCastException("Don't join"); } } static ArrayList<String> myconv(String str, int no){//only split String splitString = CONVSTR.get(no); return new ArrayList<String>(Arrays.asList(str.split(splitString))); } public static void main(String[] args){ CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, ""); solve();flush(); } //Don't have to see. end------------------------------------------ static void solve(){//Here is the main function int N = nextInt(); ArrayList<Integer> list = nextIntArray(); int output = 0; Collections.sort(list); long[] sumlist = new long[N]; for(int i = 0; i < N; i++){ sumlist[i] = list[i]; if(i != 0){ sumlist[i] += sumlist[i - 1]; } } for(int i = 0; i < N - 1; i++){ if(sumlist[i] * 2 >= list[i + 1]){ output++; }else{ output = 1; } } myout(output); } //Method addition frame start //Method addition frame end }
Main.java:78: error: array required, but ArrayList<Integer> found sumlist[i] = list[i]; ^ Main.java:84: error: array required, but ArrayList<Integer> found if(sumlist[i] * 2 >= list[i + 1]){ ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors
s955144373
p03786
C++
#include<bits/stdc++.h> using namespace std; inline int read(){ int res=0; char c; bool zf=0; while(((c=getchar())<'0'||c>'9')&&c!= '-'); if(c=='-')zf=1; else res=c-'0'; while((c=getchar())>='0'&&c<='9')res=(res<<3)+(res<<1)+c-'0'; if(zf)return -res; return res; } int data[100005]; signed main(){ int n=read(); for(register int i=1;i<=n;i++){ data[i]=read(); } sort(data+1,data+n+1); int _sum=0,ans=0; for(register int i=1;i<=n;i++){ _sum+=data[i];ans++; if(_sum*2<data[i+1])ans=0; } cout<<ans<<'\n'; return 0; }
a.cc: In function 'int main()': a.cc:17:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 17 | for(register int i=1;i<=n;i++){ | ^ a.cc:18:17: error: reference to 'data' is ambiguous 18 | data[i]=read(); | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:14:5: note: 'int data [100005]' 14 | int data[100005]; | ^~~~ a.cc:20:14: error: reference to 'data' is ambiguous 20 | sort(data+1,data+n+1); | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:14:5: note: 'int data [100005]' 14 | int data[100005]; | ^~~~ a.cc:20:21: error: reference to 'data' is ambiguous 20 | sort(data+1,data+n+1); | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:14:5: note: 'int data [100005]' 14 | int data[100005]; | ^~~~ a.cc:22:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 22 | for(register int i=1;i<=n;i++){ | ^ a.cc:23:23: error: reference to 'data' is ambiguous 23 | _sum+=data[i];ans++; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:14:5: note: 'int data [100005]' 14 | int data[100005]; | ^~~~ a.cc:24:27: error: reference to 'data' is ambiguous 24 | if(_sum*2<data[i+1])ans=0; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:14:5: note: 'int data [100005]' 14 | int data[100005]; | ^~~~
s627005950
p03786
C++
#include<bits/stdc++.h> using namespace std; inline int read(){ int res=0; char c; bool zf=0; while(((c=getchar())<'0'||c>'9')&&c!= '-'); if(c=='-')zf=1; else res=c-'0'; while((c=getchar())>='0'&&c<='9')res=(res<<3)+(res<<1)+c-'0'; if(zf)return -res; return res; } int data[100005]; signed main(){ int n=read(); for(register int i=1;i<=n;i++){ data[i]=read(); } sort(data+1,data+n+1); int sum=0,ans=0; for(register int i=1;i<=n;i++){ sum+=data[i];ans++; if(sum*2<data[i+1])ans=0; } cout<<ans<<'\n'; return 0; }
a.cc: In function 'int main()': a.cc:17:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 17 | for(register int i=1;i<=n;i++){ | ^ a.cc:18:17: error: reference to 'data' is ambiguous 18 | data[i]=read(); | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:14:5: note: 'int data [100005]' 14 | int data[100005]; | ^~~~ a.cc:20:14: error: reference to 'data' is ambiguous 20 | sort(data+1,data+n+1); | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:14:5: note: 'int data [100005]' 14 | int data[100005]; | ^~~~ a.cc:20:21: error: reference to 'data' is ambiguous 20 | sort(data+1,data+n+1); | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:14:5: note: 'int data [100005]' 14 | int data[100005]; | ^~~~ a.cc:22:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 22 | for(register int i=1;i<=n;i++){ | ^ a.cc:23:22: error: reference to 'data' is ambiguous 23 | sum+=data[i];ans++; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:14:5: note: 'int data [100005]' 14 | int data[100005]; | ^~~~ a.cc:24:26: error: reference to 'data' is ambiguous 24 | if(sum*2<data[i+1])ans=0; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:14:5: note: 'int data [100005]' 14 | int data[100005]; | ^~~~
s863043423
p03786
C++
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) typedef long long ll; typedef pair<int, int> P; const int INF = 100100100; const int MOD = (int)1e9 + 7; const double EPS = 1e-9; struct Edge { ll to; ll cost;b }; int main() { int N; cin >> N; vector<ll> A(N); REP(i, N) cin >> A[i]; sort(A.begin(), A.end(), greater<ll>()); vector<ll> wa(N); wa[N - 1] = A[N - 1]; for (int i = N - 2; i >= 0; i--) { wa[i] = wa[i + 1] + A[i]; } int ans = 0; REP(i, N - 1) { ans = i + 1; if (A[i] > 2 * wa[i + 1]) break; if (i == N - 2) ans++; } cout << ans << endl; }
a.cc:12:11: error: 'b' does not name a type 12 | ll cost;b | ^
s367965984
p03786
C++
#include <bits/stdc++.h> #解説みた。 using namespace std; typedef long long ll; #define MOD (long long)(1e9+7) #define INF (1LL<<60) #define rep(i,n) for(ll i = 0; i < (n); i++) #define rep1(i,n) for(ll i = 1; i <= (n); i++) 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; } // 最大公約数 ll gcd(ll a, ll b) { if(b == 0) return a; return gcd(b, a % b); } // mod m におけるa の逆元 ll modinv(ll a, ll m) { ll b = m, u = 1, v = 0; while (b) { ll t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } // 素因数分解 vector<pair<ll, ll>> prim; void pf(ll n) { ll s = sqrt(n); ll r = 0; for(ll i = 2; i <= s; i++) { if((n % i) == 0) { r = 0; do { r++; n = n / i; } while((n % i) == 0); prim.push_back({i, r}); } } if(n > s) { prim.push_back({n, 1}); } } void solve() { ll N; cin >> N; vector<ll> a(N); rep(i, N) cin >> a[i]; ll ans = 0; sort(a.begin(), a.end()); ll t = 0; ll s = 0; rep(i, N - 1) { s += a[i]; if(s * 2 < a[i + 1]) { t = i + 1; //cerr << "*" << i << " " << s << " " << t << endl; break; } // cerr << i << " " << s << " " << t << endl; } ans = N - t; cout << ans << endl; } int main(void) { // ll t; cin >> t; rep(i, t) solve(); }
a.cc:2:2: error: extended character 。 is not valid in an identifier 2 | #解説みた。 | ^ a.cc:2:2: error: invalid preprocessing directive #\U000089e3\U00008aac\U0000307f\U0000305f\U00003002 2 | #解説みた。 | ^~~~~~~~~~
s298569062
p03786
C++
#include <string> #include <memory> #include <vector> #include <iostream> #include <set> #include <algorithm> using namespace std; int main() { std::ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; std::vector<int> v(n); std::vector<int64_t> mxs; for (auto& el : v) { cin >> el; } std::sort(v.begin(), v.end()); int64_t cur_sum = 0; for (const auto& el : v) { mxs.push_back(max((el - 2 * cur_sum + 1) / 2, 0LL)); cur_sum += el; } int ans = 0; int last = n - 1; for (int i = n - 1; i >= 0; i--) { if (mxs[i] != 0) { last = i; break; } } int64_t mx = 0; for (int i = 0; i < last; i++) { mx = max(mx, mxs[i]); } if (mx <= v[last]) { ans = 1; } mx = max(mx, mxs[last]); for (int i = last + 1; i < n; i++) { if (mx <= v[i]) { ans++; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:26:22: error: no matching function for call to 'max(int64_t, long long int)' 26 | mxs.push_back(max((el - 2 * cur_sum + 1) / 2, 0LL)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string: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:26:22: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int') 26 | mxs.push_back(max((el - 2 * cur_sum + 1) / 2, 0LL)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:6: /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:26:22: note: mismatched types 'std::initializer_list<_Tp>' and 'long int' 26 | mxs.push_back(max((el - 2 * cur_sum + 1) / 2, 0LL)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s552266120
p03786
C++
using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define ll long long #define INF 1000000000000000000 int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vector<ll> A(N); map<ll, ll> ma; rep(i, N) { cin >> A[i]; } sort(all(A)); int cnt = 1; ll prev = 0; bool judge = 0; rep(i, N) { if (i != 0) { if (prev * 2 >= A[i]) cnt++; else cnt = 1; } prev += A[i]; } cout << cnt << endl; }
a.cc: In function 'int main()': a.cc:8:5: error: 'cin' was not declared in this scope 8 | cin.tie(0); | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:9:5: error: 'ios' has not been declared 9 | ios::sync_with_stdio(false); | ^~~ a.cc:13:5: error: 'vector' was not declared in this scope 13 | vector<ll> A(N); | ^~~~~~ a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' +++ |+#include <vector> 1 | using namespace std; a.cc:4:12: error: expected primary-expression before 'long' 4 | #define ll long long | ^~~~ a.cc:13:12: note: in expansion of macro 'll' 13 | vector<ll> A(N); | ^~ a.cc:14:5: error: 'map' was not declared in this scope 14 | map<ll, ll> ma; | ^~~ a.cc:1:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>' +++ |+#include <map> 1 | using namespace std; a.cc:4:12: error: expected primary-expression before 'long' 4 | #define ll long long | ^~~~ a.cc:14:9: note: in expansion of macro 'll' 14 | map<ll, ll> ma; | ^~ a.cc:15:24: error: 'A' was not declared in this scope 15 | rep(i, N) { cin >> A[i]; } | ^ a.cc:17:14: error: 'A' was not declared in this scope 17 | sort(all(A)); | ^ a.cc:3:17: note: in definition of macro 'all' 3 | #define all(x) (x).begin(), (x).end() | ^ a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'short'? 17 | sort(all(A)); | ^~~~ | short a.cc:33:5: error: 'cout' was not declared in this scope 33 | cout << cnt << endl; | ^~~~ a.cc:33:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:33:20: error: 'endl' was not declared in this scope 33 | cout << cnt << endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | using namespace std;
s284148139
p03786
C++
#include <bits/stdc++.h> using namespace std; //long long using ll = long long; // pair<int, int> using PII = pair<int, int>; //最大値、mod const int MOD = 1000000007; const int mod = 1000000007; const int INF = 1000000000; const long long LINF = 1e18; const int MAX = 510000; //出力系 #define print(x) cout << x << endl #define prints(x) cout << fixed << setprecision(20) << x << endl #define printc(x) cout << setw(2) << setfill('0') << x << endl; #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl //配列入力 vector<long long>vecin(ll n){ vector<long long>res(n); for(int i = 0; i < n; i++) cin >> res[i]; return res; } // begin() end() #define all(x) (x).begin(),(x).end() //for #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i) #define rrep(i,a,b) for(int i=(a);i>(b);i--) #define rep(i,a,b) for(int i=(a);i<(b);i++) //最大公約数 ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;} // 最小公倍数 unsigned lcm(unsigned a, unsigned b){ return a / gcd(a, b) * b; } // a = max(a, b), a = min(a, b) 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; } // 階乗(MODをとる) ll pow_mod(ll num, ll pow, ll mod) { ll prod = 1; num %= mod; while (pow > 0) { if (pow & 1) prod = prod * num % mod; num = num * num % mod; pow >>= 1; } return prod; } // 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度) // COMinit() // COM(x, y) // とコンビで使う // テーブルを作る前処理 long long fac[MAX], finv[MAX], inv[MAX]; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int 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; } } // 二項係数計算 long long 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; } // UnionFind struct UnionFind { vector<int> par; vector<int> rank; vector<ll> Size; UnionFind(int n = 1) { init(n); } void init(int n = 1) { par.resize(n + 1); rank.resize(n + 1); Size.resize(n + 1); for (int i = 0; i <= n; ++i) par[i] = i, rank[i] = 0, Size[i] = 1; } int root(int x) { if (par[x] == x) { return x; } else { int r = root(par[x]); return par[x] = r; } } bool issame(int x, int y) { return root(x) == root(y); } bool merge(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (rank[x] < rank[y]) swap(x, y); if (rank[x] == rank[y]) ++rank[x]; par[y] = x; Size[x] += Size[y]; return true; } ll size(int x){ return Size[root(x)]; } }; //modint構造体 struct Mint { int val; Mint inv() const{ int tmp,a=val,b=mod,x=1,y=0; while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y); return Mint(x); } public: Mint():val(0){} Mint(ll x){if((val=x%mod)<0)val+=mod;} Mint pow(ll t){Mint res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;} Mint& operator+=(const Mint& x){if((val+=x.val)>=mod)val-=mod;return *this;} Mint& operator-=(const Mint& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;} Mint& operator*=(const Mint& x){val=(ll)val*x.val%mod; return *this;} Mint& operator/=(const Mint& x){return *this*=x.inv();} bool operator==(const Mint& x) const{return val==x.val;} bool operator!=(const Mint& x) const{return val!=x.val;} bool operator<(const Mint& x) const{return val<x.val;} bool operator<=(const Mint& x) const{return val<=x.val;} bool operator>(const Mint& x) const{return val>x.val;} bool operator>=(const Mint& x) const{return val>=x.val;} Mint operator+(const Mint& x) const{return Mint(*this)+=x;} Mint operator-(const Mint& x) const{return Mint(*this)-=x;} Mint operator*(const Mint& x) const{return Mint(*this)*=x;} Mint operator/(const Mint& x) const{return Mint(*this)/=x;} }; struct factorial { vector<Mint> Fact, Finv; public: //factorial fact(10000010); //fact.nCr(a, b) //「fact」の部分は自由に名前変更可能 factorial(int maxx){ Fact.resize(maxx+1),Finv.resize(maxx+1); Fact[0]=Mint(1); rep(i,0,maxx)Fact[i+1]=Fact[i]*(i+1); Finv[maxx]=Mint(1)/Fact[maxx]; rrep(i,maxx,0)Finv[i-1]=Finv[i]*i; } Mint fact(int n,bool inv=0){if(inv)return Finv[n];else return Fact[n];} Mint nPr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[n-r];} Mint nCr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[r]*Finv[n-r];} }; // 1 * 2 * 3 .... * n (mod) ll modfact(ll n) { if (n <= 1) return 1; return (n * modfact(n - 1)) % MOD; } // kが角度だった場合:cos(k * (PI / 180)); //const double PI = acos(-1);のまま使うと円周率(M_PIもあるよ) const double PI = acos(-1); // 多次元 vector 生成 例: auto dp = make_vec<long long>(N+1, 5, 5, 5); template<class T> vector<T> make_vec(size_t a){ return vector<T>(a); } template<class T, class... Ts> auto make_vec(size_t a, Ts... ts){ return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); } //素因数分解 vector<pair<long long, int>>factorize(long long n){ vector<pair<long long, int>> res; for(long long i = 2; i * i <= n; ++i){ if(n % i) continue; res.emplace_back(i, 0); while(n % i == 0){ n /= i; res.back().second++; } } if(n != 1) res.emplace_back(n, 1); return res; } // 素数判定 bool primejudge(long long a){ if(a <= 1) return false; for(long long i = 2; i * i <= a; i++){ if(a % i == 0) return false; } return true; } //累積和 // vector<long long>sums(vector<int>n){ // vector<long long>res(n.size() + 1, 0); // for(int i = 0; i < n.size(); i++) res[i + 1] = n[i] + res[i]; // return res; // } //int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0}; int main(){ int n; cin >> n vector<int>a(n); REP(i, n) cin >> a[i]; sort(all(a)); ll now = a[0], pos = 0; REP(i, n){ if(i == 0) continue; if(now * 2 < a[i]) pos = i; now += a[i]; } print(n - pos); return 0; }
a.cc: In function 'int main()': a.cc:243:20: error: expected ';' before 'vector' 243 | int n; cin >> n | ^ | ; 244 | vector<int>a(n); | ~~~~~~ a.cc:245:22: error: 'a' was not declared in this scope 245 | REP(i, n) cin >> a[i]; | ^ a.cc:246:14: error: 'a' was not declared in this scope 246 | sort(all(a)); | ^ a.cc:35:17: note: in definition of macro 'all' 35 | #define all(x) (x).begin(),(x).end() | ^ a.cc:250:28: error: 'pos' was not declared in this scope; did you mean 'pow'? 250 | if(now * 2 < a[i]) pos = i; | ^~~ | pow a.cc:253:15: error: 'pos' was not declared in this scope; did you mean 'pow'? 253 | print(n - pos); | ^~~ a.cc:19:26: note: in definition of macro 'print' 19 | #define print(x) cout << x << endl | ^
s355378830
p03786
C++
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG int64_t MOD=1000000007; int main() { int64_t N; cin>>N; vector<int64_t> S(N); for(int i=0;i<N;i++) cin>>S.at(i); sort(S.begin(),S.end()); int64_t total=S.at(0); for(int i=1;i<N;i++){ if(2*total<S.at(i)) S.at(i-1)=0; total+=S.at(i); } int64_t ans=0; for(int i=0;i<N;i++){ ans++; if(S.at(0)==0) ans=0; } cout<<ans;
a.cc: In function 'int main()': a.cc:22:13: error: expected '}' at end of input 22 | cout<<ans; | ^ a.cc:6:12: note: to match this '{' 6 | int main() { | ^
s801492328
p03786
C++
#include <iostream> #include <vector> #include <queue> using namespace std; vector<long long> a; int main(int argc, char* argv[]) { int N; cin >> N; a.resize(N); vector<long long> indices(N); for (int i = 0; i < N; ++i) { cin >> a[i]; indices[i] = i; } sort(a.begin(), a.end()); long long ret = 0; long long sum = 0; for (int i = 0; i < N; ++i) { if (i == 0) { sum += a[i]; ret = 1; } else { if (a[i] > 2 * sum) { sum += a[i]; N -= ret; } else { sum += a[i]; ++ret; } } } cout << N << endl; return 0; }
a.cc: In function 'int main(int, char**)': a.cc:20:3: error: 'sort' was not declared in this scope; did you mean 'short'? 20 | sort(a.begin(), a.end()); | ^~~~ | short
s296792928
p03786
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; vector<int64_t>A(N); for(int i=0;i<N;i++) cin>>A.at(i); sort(A.begin(),A.end()); int left=-1; int right=N; while(1<right-left){ int mid=left+(right-left)/2; int64_t sum=0; for(int i=0;i<=mid;i++) sum+=A.at(i); bool x=true; for(int i=mid+1;i<N;i++){ if(A.at(i)<=2*sum) sum+=A.at(i); else{x=false; break;} }if(x)right=mid; else left=mid; }int ans=N-mid; cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:25:14: error: 'mid' was not declared in this scope 25 | }int ans=N-mid; | ^~~
s384979950
p03786
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int n;cin>>n; vector<long long>A(n); vector<long long>B(n+2); for(int i = 0; n > i; i++){ cin>>A[i]; } sort(A.begin(),A.end()); B[0] = 0; for(int i = 0; n > i; i++){ B[i+1] = B[i]+A[i]; } B[n+1] = 0; for(int i = 1; n >= i; i++){ if(B[i]*2 >= B[i+1]){ cout << n-i+1 << endl; return 0; } } }
a.cc: In function 'int main()': a.cc:6:3: error: 'vector' was not declared in this scope 6 | vector<long long>A(n); | ^~~~~~ a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 2 | #include <algorithm> +++ |+#include <vector> 3 | using namespace std; a.cc:6:10: error: expected primary-expression before 'long' 6 | vector<long long>A(n); | ^~~~ a.cc:7:10: error: expected primary-expression before 'long' 7 | vector<long long>B(n+2); | ^~~~ a.cc:9:10: error: 'A' was not declared in this scope 9 | cin>>A[i]; | ^ a.cc:11:8: error: 'A' was not declared in this scope 11 | sort(A.begin(),A.end()); | ^ a.cc:12:3: error: 'B' was not declared in this scope 12 | B[0] = 0; | ^
s283320271
p03786
C
#include <bits/stdc++.h> using ll = long long; using namespace std; ll GCD(ll a, ll b){ return a ? GCD(b % a, a) : b; } int main(){ int n; cin>>n; vector<ll> a(n); for(int i=0; i<n; i++) cin>>a[i]; sort(a.begin(),a.end()); vector<ll> sum(n+1); sum[0]=0; for(int i=0; i<n; i++) sum[i+1] = sum[i] + a[i]; int cnt=n; for(int i=0; i<n; i++){ if(2*sum[i]<a[i]){ cnt=n-i; } } cout<<cnt<<endl; }
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s598582678
p03786
C++
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #define all(x) (x).begin(),(x).end() #define rep(i, n) for(int (i) = 0; i < (n); i++) #define REP(i, m, n) for(int (i) = (m); (i) < (n); (i)++) #define INF LLONG_MAX - 10 #define MOD 1000000007 #define fcout cout << fixed << setprecision(15) #define int long long #define yorn(f) puts((f)?"Yes":"No") #define YORN(f) puts((f)?"YES":"NO") typedef long long ll; typedef pair<int, int> P; typedef priority_queue<int> pque; int gcd(int a,int b){return b?gcd(b,a%b):a;}; int lcm(int a,int b){return a*b/gcd(a,b);}; int mod(int a,int b){return (a+b-1)/b;}; int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31}; template<typename A, size_t N, typename T> void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);} 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;}; signed main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); itn n; cin >> n; int a[n]; rep(i, n) cin >> a[i]; sort(a, a + n); int sum[n + 10] = {}; rep(i, n) { sum[i+1] = sum[i] + a[i]; } int ans = 1; rep(i, n) { if(sum[i] * 2 >= a[i]) ans++; else ans = 0; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:32:5: error: 'itn' was not declared in this scope; did you mean 'int'? 32 | itn n; | ^~~ | int a.cc:33:12: error: 'n' was not declared in this scope; did you mean 'yn'? 33 | cin >> n; | ^ | yn a.cc:35:22: error: 'a' was not declared in this scope 35 | rep(i, n) cin >> a[i]; | ^ a.cc:37:10: error: 'a' was not declared in this scope 37 | sort(a, a + n); | ^ a.cc:40:9: error: 'sum' was not declared in this scope 40 | sum[i+1] = sum[i] + a[i]; | ^~~ a.cc:45:12: error: 'sum' was not declared in this scope 45 | if(sum[i] * 2 >= a[i]) ans++; | ^~~
s701817357
p03786
C++
n = int(input()) a = [ int(x) for x in input().split() ] a.sort() t = 0 s = 0 for k, v in enumerate(a): s += v if k+1 < n and s*2 < a[k+1]: t = k+1 print(n-t)
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^