submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s404087085
p00097
C++
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * 0 から 100 の数字から異なる n 個の数を取り出して合計が s となる組み合わせの数を出力する * n 個の数はおのおの 0 から 100 までとし、1つの組み合わせに同じ数字は使えません。 * @author sugawara-a2 * */ public class Main { final private static int LIMIT = 100; public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); while (input.ready()) { String[] INPUT_STR = input.readLine().split(" "); int numCount = Integer.valueOf(INPUT_STR[0]); int sumNumber = Integer.valueOf(INPUT_STR[1]); if (numCount == 0 && sumNumber == 0) { break; } long ans = solver(numCount, sumNumber); System.out.println(ans); } } private static long solver(int numCount, int sumNumber) { // n個(numCount)の重複しない0以上の整数を足し合わせた際の最小値が // sumNumberより大きい場合は組合せなし if (sumNumber < sumUp(numCount - 1)) { return 0; } // n個(numCount)の重複しないLIMIT以下の整数を足し合わせた際の最大値が // sumNumberより小さい場合は組合せなし if ((LIMIT * numCount) - sumUp(numCount - 1) < sumNumber) { return 0; } // n個(numCount)の重複しない0以上の整数を足し合わせた際の最小値をsumNumberから除算した値とLIMITを比較し小さい値を開始数にする int startIndex = Math.min(LIMIT, sumNumber - sumUp(numCount - 1)); sumNumber = sumNumber - sumUp(numCount - 1); return solver(numCount, sumNumber, 0, startIndex); } private static long solver(int numCount, int sumNumber, int currentSum, int startIndex) { long ret = 0; for (int i = numCount; i > 0; i--) { startIndex = startIndex / 2; ret += startIndex; } return ret; } private static int sumUp(int num) { // ZeroOrigin num--; return (int) ((int) (num + 1) * num * 0.5); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.BufferedReader; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.io.IOException; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.io.InputStreamReader; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:12:1: error: expected unqualified-id before 'public' 12 | public class Main | ^~~~~~
s165799661
p00097
C++
#include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include <sstream> #include <deque> #include <complex> #include <stack> #include <queue> #include <cstdio> #include <cctype> #include <cstring> #include <ctime> #include <iterator> #include <bitset> #include <numeric> #include <list> #include <iomanip> #if __cplusplus >= 201103L #include <array> #include <tuple> #include <initializer_list> #include <unordered_set> #include <unordered_map> #include <forward_list> #define cauto const auto& #else #endif using namespace std; namespace{ typedef long long LL; typedef pair<int,int> pii; typedef pair<LL,LL> pll; typedef vector<int> vint; typedef vector<vector<int> > vvint; typedef vector<long long> vll, vLL; typedef vector<vector<long long> > vvll, vvLL; #define VV(T) vector<vector< T > > template <class T> void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){ v.assign(a, vector<T>(b, t)); } template <class F, class T> void convert(const F &f, T &t){ stringstream ss; ss << f; ss >> t; } #define reep(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) reep((i),0,(n)) #define ALL(v) (v).begin(),(v).end() #define PB push_back #define F first #define S second #define mkp make_pair #define RALL(v) (v).rbegin(),(v).rend() #define MOD 1000000007LL #define EPS 1e-8 static const int INF=1<<24; ll dp[11][110][1010]; void mainmain(){ rep(i,101){ dp[1][i][i]=1; } reep(i,2,10){ reep(j,0,101){ reep(k,0,1001){ reep(l,j+1,101){ if(k-l<0) break; dp[i][l][k]+=dp[i-1][j][k-l]; } } } } int n,s; while(cin>>n>>s,n||s){ ll ans=0; rep(i,101){ ans+=dp[n][i][s]; } cout<<ans<<endl; } } } main() try{ mainmain(); } catch(...){ }
a.cc:83:1: error: 'll' does not name a type; did you mean 'vll'? 83 | ll dp[11][110][1010]; | ^~ | vll a.cc: In function 'void {anonymous}::mainmain()': a.cc:86:17: error: 'dp' was not declared in this scope 86 | dp[1][i][i]=1; | ^~ a.cc:93:41: error: 'dp' was not declared in this scope 93 | dp[i][l][k]+=dp[i-1][j][k-l]; | ^~ a.cc:100:17: error: 'll' was not declared in this scope; did you mean 'vll'? 100 | ll ans=0; | ^~ | vll a.cc:102:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 102 | ans+=dp[n][i][s]; | ^~~ | abs a.cc:102:30: error: 'dp' was not declared in this scope 102 | ans+=dp[n][i][s]; | ^~ a.cc:104:23: error: 'ans' was not declared in this scope; did you mean 'abs'? 104 | cout<<ans<<endl; | ^~~ | abs a.cc: At global scope: a.cc:111:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 111 | main() try{ | ^~~~
s009019594
p00097
C++
#include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include <sstream> #include <deque> #include <complex> #include <stack> #include <queue> #include <cstdio> #include <cctype> #include <cstring> #include <ctime> #include <iterator> #include <bitset> #include <numeric> #include <list> #include <iomanip> #if __cplusplus >= 201103L #include <array> #include <tuple> #include <initializer_list> #include <unordered_set> #include <unordered_map> #include <forward_list> #define cauto const auto& #else #endif using namespace std; namespace{ typedef long long ll; typedef pair<int,int> pii; typedef pair<LL,LL> pll; typedef vector<int> vint; typedef vector<vector<int> > vvint; typedef vector<long long> vll, vLL; typedef vector<vector<long long> > vvll, vvLL; #define VV(T) vector<vector< T > > template <class T> void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){ v.assign(a, vector<T>(b, t)); } template <class F, class T> void convert(const F &f, T &t){ stringstream ss; ss << f; ss >> t; } #define reep(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) reep((i),0,(n)) #define ALL(v) (v).begin(),(v).end() #define PB push_back #define F first #define S second #define mkp make_pair #define RALL(v) (v).rbegin(),(v).rend() #define MOD 1000000007LL #define EPS 1e-8 static const int INF=1<<24; ll dp[11][110][1010]; void mainmain(){ rep(i,101){ dp[1][i][i]=1; } reep(i,2,10){ reep(j,0,101){ reep(k,0,1001){ reep(l,j+1,101){ if(k-l<0) break; dp[i][l][k]+=dp[i-1][j][k-l]; } } } } int n,s; while(cin>>n>>s,n||s){ ll ans=0; rep(i,101){ ans+=dp[n][i][s]; } cout<<ans<<endl; } } } main() try{ mainmain(); } catch(...){ }
a.cc:48:14: error: 'LL' was not declared in this scope; did you mean 'll'? 48 | typedef pair<LL,LL> pll; | ^~ | ll a.cc:48:17: error: 'LL' was not declared in this scope; did you mean 'll'? 48 | typedef pair<LL,LL> pll; | ^~ | ll a.cc:48:19: error: template argument 1 is invalid 48 | typedef pair<LL,LL> pll; | ^ a.cc:48:19: error: template argument 2 is invalid a.cc:111:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 111 | main() try{ | ^~~~
s850226492
p00097
C++
#include<iostream> #include<algorithm> #include<string> using namespace std; __int64 dp[101][1001][10]; int main(){ int n,s; dp[0][0][0]=1; for(int i=0;i<100;i++){ for(int j=0;j<=1000;j++){ for(int k=0;k<=9;k++){ if(k<9)dp[i+1][i+j][k+1]+=dp[i][j][k]; dp[i+1][j][k]+=dp[i][j][k]; } } } while(cin>>n>>s,(n||s) ){ cout<<dp[100][s][n]<<endl; } return 0; }
a.cc:5:1: error: '__int64' does not name a type; did you mean '__int64_t'? 5 | __int64 dp[101][1001][10]; | ^~~~~~~ | __int64_t a.cc: In function 'int main()': a.cc:8:17: error: 'dp' was not declared in this scope 8 | dp[0][0][0]=1; | ^~
s796649089
p00097
C++
#define _crt_secure_no_warnings #ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #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> #ifdef __GXX_EXPERIMENTAL_CXX0X__ #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> #endif #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> #ifdef __GXX_EXPERIMENTAL_CXX0X__ #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> #endif using namespace std; //int data[10][1001][11] = {}; long long int saiki(int a, int b, int c) { if (b < 0)return 0; if (a == 0)return b == 0; long long int count = 0; for (size_t i = c; i < 101&&b-i>=0; i++) { if (i+1 < 11) { //if (!data[a - 1][b - i][i + 1]) { data[a - 1][b - i][i + 1] = saiki(a - 1, b - i, i + 1); } count += data[a - 1][b - i][i + 1]; } else { count += saiki(a - 1, b - i, i + 1); } } return count; } int main() { int a, b; while (1) { cin >> a >> b; if (a == 0)break; cout << saiki(a, b, 0) << endl;; } }
a.cc: In function 'long long int saiki(int, int, int)': a.cc:103:37: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 103 | data[a - 1][b - i][i + 1] = saiki(a - 1, b - i, i + 1); | ^ a.cc:105:38: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 105 | count += data[a - 1][b - i][i + 1]; | ^
s671629004
p00097
C++
#include <stdio.h> typedef long ll; ll memo[10][1010]; ll dfs(int n, int s, int x) { ll pat = 0; if (n == 0) return s == 0; if (s < 0) return 0; if (x > 100) return 0; if (memo[n][s] != -1) return memo[n][s]; for (; x <= 100; x++){ pat += dfs(n - 1, s - x, x + 1); } return pat; } int main(void) { int N, S; while (scanf("%d %d", &N, &S), N || S){ memset(memo, -1, sizeof(memo)); printf("%ld\n", dfs(N, S, 0)); } return 0; }
a.cc: In function 'int main()': a.cc:24:17: error: 'memset' was not declared in this scope 24 | memset(memo, -1, sizeof(memo)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <stdio.h> +++ |+#include <cstring> 2 |
s177056612
p00097
C++
#include <bits/stdc++.h> #define range(i,a,b) for(int (i)=(a);(i)<(b);(i)++) #define rep(i,n) range(i,0,n) using namespace std; int n,s; ll dp[10][1010]; int main(void){ dp[0][0]=1LL; rep(i,101){ for(int j=8;j>=0;j--)rep(k,1010){ if(k+i<=1010) dp[j+1][k+i]+=dp[j][k]; } } while(cin >> n >> s,n){ cout << dp[n][s] << endl; } return 0; }
a.cc:9:1: error: 'll' does not name a type 9 | ll dp[10][1010]; | ^~ a.cc: In function 'int main()': a.cc:12:9: error: 'dp' was not declared in this scope; did you mean 'dup'? 12 | dp[0][0]=1LL; | ^~ | dup
s709757983
p00097
C++
#include <string> #include <iostream> using namespace std; int main() { int n[50], s[50], c = 0, dp[101][901][101]; long long SUM = 0; memset(dp, 0, sizeof(dp)); for (int i = 0; i <= 100; i++) { dp[1][i][i] = 1; } for (int N = 2; N <= 100; N++) { for (int i = 1; i <= 100; i++) { for (int j = 1; j <= 900; j++) { if (j - i >= 0) { for (int k = 0; k < i; k++) { dp[N][i][j] += dp[N - 1][k][j - i]; } } } } } while (true) { cin >> n[c] >> s[c]; if (n[c] == 0 && s[c] == 0) { goto Exit; } c++; } Exit:; for (int p = 0; p < c; p++) { SUM = 0; for (int i = 0; i < 100; i++) { SUM += dp[n[p]][i][s[p]]; } cout << SUM << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:9: error: 'memset' was not declared in this scope 12 | memset(dp, 0, sizeof(dp)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <iostream> +++ |+#include <cstring> 3 |
s757873778
p00097
C++
#include <string> #include <iostream> using namespace std; int main() { int n[50], s[50], c = 0, dp[101][101][901]; long long SUM = 0; memset(dp, 0, sizeof(dp)); for (int i = 0; i <= 100; i++) { dp[1][i][i] = 1; } for (int N = 2; N <= 100; N++) { for (int i = 1; i <= 100; i++) { for (int j = 1; j <= 900; j++) { if (j - i >= 0) { for (int k = 0; k < i; k++) { dp[N][i][j] += dp[N - 1][k][j - i]; } } } } } while (true) { cin >> n[c] >> s[c]; if (n[c] == 0 && s[c] == 0) { goto Exit; } c++; } Exit:; for (int p = 0; p < c; p++) { SUM = 0; for (int i = 0; i < 100; i++) { SUM += dp[n[p]][i][s[p]]; } cout << SUM << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:9: error: 'memset' was not declared in this scope 12 | memset(dp, 0, sizeof(dp)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <iostream> +++ |+#include <cstring> 3 |
s618655169
p00097
C++
#include<iostream> #include<algorithm> #include<functional> using namespace std; typedef long long ll; ll dp[1001][10][101];//???????????£?????°????????°????????£?????????????????§??? int main() { int n, s; while (cin >> n >> s, n+s) { memset(dp, 0, sizeof(dp)); for (int j = 0; j <= n; j++) { for (int i = 0; i <= s; i++) { for (int k = 0; k <= s; k++) { if (i - k >= 0) dp[i][j][k] += dp[i - k][j - 1][k - 1]; if (i == k && j == 1) dp[i][j][k]++; if (k > i) dp[i][j][k] += dp[i][j][k - 1]; // cout << i << " " << j << " " << k << " " << dp[i][j][k] << endl; } } } int ans = 0; for (int i = 0; i <= s; i++) { ans += dp[s][n][i]; } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:17: error: 'memset' was not declared in this scope 14 | memset(dp, 0, sizeof(dp)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<functional> +++ |+#include <cstring> 4 |
s082695138
p00097
C++
ric> #include <complex> #include <sstream> #include <fstream> #include <iomanip> #include <cassert> #include <iostream> #include <iterator> #include <algorithm> using namespace std; #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i, n) REP(i, 0, n) #define lengthof(x) (sizeof(x) / sizeof(*(x))) #define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value)) template <typename T> void FILL_(void * ptr, size_t size, T value){ std::fill((T*)ptr, (T*)ptr+size, value); } //4?????????????????????????????? int dx[] ={1,0,-1,0}; int dy[] ={0,-1,0,1}; int n;//???????????° int s;//?±?????????? int ans; long long int dp[10][1010];//dp[n][s]s???n????????´??°??§??¨?????¨????????????????????? int main() { memset(dp,0,sizeof(dp)); dp[0][0] = 1; for(int i = 0; i <101;i++){ for(int j = 1000;j >-1;j--){ for(int k = 9;k >0;k--){ if(j-i>=0){ dp[k][j] +=dp[k-1][j-i]; } } } } while(cin >>n>>s,n||s){ cout <<dp[n][s]<<endl; } return 0; }ric> #include <complex> #include <sstream> #include <fstream> #include <iomanip> #include <cassert> #include <iostream> #include <iterator> #include <algorithm> using namespace std; #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i, n) REP(i, 0, n) #define lengthof(x) (sizeof(x) / sizeof(*(x))) #define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value)) template <typename T> void FILL_(void * ptr, size_t size, T value){ std::fill((T*)ptr, (T*)ptr+size, value); } //4?????????????????????????????? int dx[] ={1,0,-1,0}; int dy[] ={0,-1,0,1}; int n;//???????????° int s;//?±?????????? int ans; long long int dp[10][1010];//dp[n][s]s???n????????´??°??§??¨?????¨????????????????????? int main() { memset(dp,0,sizeof(dp)); dp[0][0] = 1; for(int i = 0; i <101;i++){ for(int j = 1000;j >-1;j--){ for(int k = 9;k >0;k--){ if(j-i>=0){ dp[k][j] +=dp[k-1][j-i]; } } } } while(cin >>n>>s,n||s){ cout <<dp[n][s]<<endl; } return 0; }
a.cc:1:1: error: 'ric' does not name a type 1 | ric> | ^~~ In file included from /usr/include/c++/14/complex:43, 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, from /usr/include/c++/14/bits/specfun.h:43, from /usr/include/c++/14/cmath:3906, from /usr/include/c++/14/complex:44: /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:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ In file included from /usr/include/stdlib.h:32, from /usr/include/c++/14/bits/std_abs.h:38, from /usr/include/c++/14/cmath:49: /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/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'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /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/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'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /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/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'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /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/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:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:65: /usr/include/c++/14/bits/stl_iterator_base_types.h:125:67: error: 'ptrdiff_t' does not name a type 125 | template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:1:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' +++ |+#include <cstddef> 1 | // Types used in iterator implementation -*- C++ -*- /usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: error: 'ptrdiff_t' does not name a type 214 | typedef ptrdiff_t difference_type; | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: error: 'ptrdiff_t' does not name a type 225 | typedef ptrdiff_t difference_type; | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' In file included from /usr/include/c++/14/bits/stl_algobase.h:66: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:112:5: error: 'ptrdiff_t' does not name a type 112 | ptrdiff_t | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 65 | #include <debug/assertions.h> +++ |+#include <cstddef> 66 | #include <bits/stl_iterator_base_types.h> /usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: error: 'ptrdiff_t' does not name a type 118 | ptrdiff_t | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' In file included from /usr/include/c++/14/bits/stl_iterator.h:67, from /usr/include/c++/14/bits/stl_algo
s198404392
p00097
C++
#include<bits/stdc++.h> using namespace std; int dp[11][1001] int serch(int i,int j,int n) { if(dp[i][j]>-1)return dp[i][j]; else if(!n&&!j)return 1; else if(i==10||!n)return 0; return dp[i][j]=serch(i+1,j-i,n-1)+serch(i+1,j,n); } int main() { int n,s; memset(dp,-1,sizeof(dp)); while(cin>>n>>s&&n!=0)cout<<serch(0,s,n)<<endl; }
a.cc:4:1: error: expected initializer before 'int' 4 | int serch(int i,int j,int n) | ^~~ a.cc: In function 'int main()': a.cc:14:12: error: 'dp' was not declared in this scope; did you mean 'dup'? 14 | memset(dp,-1,sizeof(dp)); | ^~ | dup a.cc:15:33: error: 'serch' was not declared in this scope; did you mean 'strchr'? 15 | while(cin>>n>>s&&n!=0)cout<<serch(0,s,n)<<endl; | ^~~~~ | strchr
s595612427
p00097
C++
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<n;i++) #define FOR(i,a,b) for(int i=a;i<=b;i++) #define DOWN(i,b,a) for(int i=b;i>=a;i--) typedef long long ll; int main() { ll dp[11][1001]={}; dp[0][0] = 1; FOR(k,0,101) DOWN(i,10,1) FOR(j,k,1000) dp[i][j] += dp[i-1][j-k]; int n, s; while(cin>>n>>s,n) cout << dp[n][s] << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 16 | while(cin>>n>>s,n) cout << dp[n][s] << endl; | ^~~ | std::cin In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146, from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:16:22: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 16 | while(cin>>n>>s,n) cout << dp[n][s] << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:16:42: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 16 | while(cin>>n>>s,n) cout << dp[n][s] << endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s292738015
p00097
C++
#include <iostream> using namespace std; long long x,s,dp[11][1001]; int main(void){ dp[0][0] = 1; for(int i=0;i<101;i++) for(int j=9;j>=0;j--) for(int k=0;i+k<1001;k++) dp[j+1][k+i]+=dp[j][k]; while(cin >> x >> s, n|s) cout << dp[x][s] << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:26: error: 'n' was not declared in this scope 12 | while(cin >> x >> s, n|s) | ^
s370244560
p00097
C++
#include <stdio.h> #include <cmath> #include <algorithm> #include <stack> #include <queue> #include <vector> using namespace std; long long int*** dp; void func(int n,int s){ for(int i = 1; i <= n; i++){ for(int k = 0; k <= 100; k++){ for(int p = 0; p <= s; p++)dp[i][k][p] = 0; } } for(int i = 0; i <= 100; i++){ dp[1][i][i] = 1; } for(int i = 2; i <= n; i++){ for(int k = 0; k <= 100; k++){ for(int a = 0; a <= k-1; a++){ for(int p = k; p <= s; p++){ dp[i][k][p] += dp[i-1][a][p-k]; } } } } int ans = 0; for(int i = 0; i <= 100; i++)ans += dp[n][i][s]; printf("%lld\n",ans); } int main(){ dp = new int**[10]; for(int i = 1; i <= 9; i++){ dp[i] = new int*[101]; for(int k = 0; k <= 100; k++){ dp[i][k] = new int[1001]; } } int n,s; while(true){ scanf("%d %d",&n,&s); if(n == 0 && s == 0)break; func(n,s); } return 0; }
a.cc: In function 'int main()': a.cc:43:14: error: cannot convert 'int***' to 'long long int***' in assignment 43 | dp = new int**[10]; | ^~~~~~~~~~~~~ | | | int*** a.cc:45:25: error: cannot convert 'int**' to 'long long int**' in assignment 45 | dp[i] = new int*[101]; | ^~~~~~~~~~~~~ | | | int** a.cc:47:36: error: cannot convert 'int*' to 'long long int*' in assignment 47 | dp[i][k] = new int[1001]; | ^~~~~~~~~~~~~ | | | int*
s800951153
p00097
C++
#include <stdio.h> #include <cmath> #include <algorithm> #include <stack> #include <queue> #include <vector> using namespace std; int main(){ long long int dp = new long long int**[10]; for(int i = 1; i <= 9; i++){ dp[i] = new long long int*[101]; for(int k = 0; k <= 100; k++){ dp[i][k] = new long long int[1001]; for(int p = 0; p <= 1000; p++)dp[i][k][p] = 0; } } for(int i = 0; i <= 100; i++){ dp[1][i][i] = 1; } for(int i = 2; i <= 9; i++){ for(int k = 0; k <= 100; k++){ for(int a = 0; a <= k-1; a++){ for(int p = k; p <= 1000; p++){ dp[i][k][p] += dp[i-1][a][p-k]; } } } } long long int ans; int n,s; while(true){ scanf("%d %d",&n,&s); if(n == 0 && s == 0)break; ans = 0; for(int i = 0; i <= 100; i++)ans += dp[n][i][s]; printf("%lld\n",ans); } return 0; }
a.cc: In function 'int main()': a.cc:12:50: error: invalid conversion from 'long long int***' to 'long long int' [-fpermissive] 12 | long long int dp = new long long int**[10]; | ^ | | | long long int*** a.cc:14:19: error: invalid types 'long long int[int]' for array subscript 14 | dp[i] = new long long int*[101]; | ^ a.cc:16:27: error: invalid types 'long long int[int]' for array subscript 16 | dp[i][k] = new long long int[1001]; | ^ a.cc:17:57: error: invalid types 'long long int[int]' for array subscript 17 | for(int p = 0; p <= 1000; p++)dp[i][k][p] = 0; | ^ a.cc:22:19: error: invalid types 'long long int[int]' for array subscript 22 | dp[1][i][i] = 1; | ^ a.cc:29:43: error: invalid types 'long long int[int]' for array subscript 29 | dp[i][k][p] += dp[i-1][a][p-k]; | ^ a.cc:29:58: error: invalid types 'long long int[int]' for array subscript 29 | dp[i][k][p] += dp[i-1][a][p-k]; | ^ a.cc:43:55: error: invalid types 'long long int[int]' for array subscript 43 | for(int i = 0; i <= 100; i++)ans += dp[n][i][s]; | ^
s311276005
p00097
C++
#include <iostream> #include <stdio.h> #include <string.h> #include <string> #include <algorithm> #define max(a,b) {a > b ? a:b} using namespace std; //????´????????????§????????????????????? #define P 101 #define MAX 1000000000 int cnt; void rec(int prev_i, int n, int s) { if (n == 1) { if (s > prev_i && s <= 100) cnt++; return; } /* if (n == 2) { if ((s - 1) / 2 - prev_i > 0) { cnt += (s - 1) / 2 - prev_i; } return; } */ for (int i = max(prev_i + 1,0 s - 100* n); i < P; i++) { if (s - i*n < 0) return; rec(i, n - 1, s - i); } } void q97() { int n, s; for (; cin >> n >> s;) { if (!n && !s) break; cnt = 0; rec(-1, n, s); cout << cnt << endl; } } int main() { q97(); return 0; }
a.cc: In function 'void rec(int, int, int)': a.cc:31:39: error: expected '}' before 's' 31 | for (int i = max(prev_i + 1,0 s - 100* n); i < P; i++) { | ^ a.cc:7:23: note: in definition of macro 'max' 7 | #define max(a,b) {a > b ? a:b} | ^ a.cc:7:18: note: to match this '{' 7 | #define max(a,b) {a > b ? a:b} | ^ a.cc:31:22: note: in expansion of macro 'max' 31 | for (int i = max(prev_i + 1,0 s - 100* n); i < P; i++) { | ^~~ a.cc:31:39: error: expected ';' before 's' 31 | for (int i = max(prev_i + 1,0 s - 100* n); i < P; i++) { | ^ a.cc:7:23: note: in definition of macro 'max' 7 | #define max(a,b) {a > b ? a:b} | ^ a.cc:31:39: error: expected ';' before 's' 31 | for (int i = max(prev_i + 1,0 s - 100* n); i < P; i++) { | ^ a.cc:7:29: note: in definition of macro 'max' 7 | #define max(a,b) {a > b ? a:b} | ^ a.cc:7:30: error: expected ')' before '}' token 7 | #define max(a,b) {a > b ? a:b} | ^ a.cc:31:22: note: in expansion of macro 'max' 31 | for (int i = max(prev_i + 1,0 s - 100* n); i < P; i++) { | ^~~ a.cc:31:13: note: to match this '(' 31 | for (int i = max(prev_i + 1,0 s - 100* n); i < P; i++) { | ^ a.cc:7:30: error: expected primary-expression before '}' token 7 | #define max(a,b) {a > b ? a:b} | ^ a.cc:31:22: note: in expansion of macro 'max' 31 | for (int i = max(prev_i + 1,0 s - 100* n); i < P; i++) { | ^~~ a.cc: At global scope: a.cc:31:52: error: 'i' does not name a type 31 | for (int i = max(prev_i + 1,0 s - 100* n); i < P; i++) { | ^ a.cc:31:59: error: 'i' does not name a type 31 | for (int i = max(prev_i + 1,0 s - 100* n); i < P; i++) { | ^ a.cc:35:1: error: expected declaration before '}' token 35 | } | ^
s918212694
p00097
C++
#include <iostream> #include <stdio.h> #include <string.h> #include <string> #include <algorithm> #define max(a,b) {a > b ? a:b} using namespace std; //????´????????????§????????????????????? #define P 101 #define MAX 1000000000 int cnt; void rec(int prev_i, int n, int s) { //if (cnt > MAX) return; /*if (!n) { if (!s) cnt++; return; }*/ if (n == 1) { if (s > prev_i && s <= 100) cnt++; return; } if (n == 2) { if (s > 100+99) return; int t = max(prev_i, s - 100 - 1); if ((s - 1) / 2 - t > 0) { cnt += (s - 1) / 2 - t; } return; } for (int i = max(prev_i + 1, s - 100* n); i < P; i++) { if (s - i*n < 0) return; rec(i, n - 1, s - i); } } void q97() { int n, s; for (; cin >> n >> s;) { if (!n && !s) break; cnt = 0; rec(-1, n, s); cout << cnt << endl; } }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s176911155
p00097
C++
# include <iostream> # include <algorithm> # include <vector> # include <string> # include <set> # include <map> # include <cmath> # include <iomanip> # include <functional> # include <utility> # include <stack> # include <queue> # include <list> constexpr int MOD = 1000000000 + 7; constexpr int INF = 2000000000; using namespace std; int main() { int dp[11][101][1001]; memset(dp, 0, sizeof(dp)); for (int i = 0; i < 10; i++) { for (int j = 0; j <= 100; j++) { if (i == 0 && j == 0)dp[0][0][0] = 1; else if (i == 0 || j == 0)continue; for (int d = 1; d + j <= 1000;d++) { dp[i][j][d + j] += dp[i - 1][j][d]; } } } int a, b; while (cin >> a >> b && (a || b)) { if (a == 1 && b == 0)cout << 1 << endl; else { int ans = 0; for (int i = 0; i <=100 ; i++) { ans += dp[a][i][b]; } cout << ans << endl; } } }
a.cc: In function 'int main()': a.cc:21:9: error: 'memset' was not declared in this scope 21 | memset(dp, 0, sizeof(dp)); | ^~~~~~ a.cc:14:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 13 | # include <list> +++ |+#include <cstring> 14 | constexpr int MOD = 1000000000 + 7;
s145145506
p00097
C++
#include <bits/stdc++.h> using namespace std; int x,y; int cnt[]; int mySet(int d,int sum,int n){ int a=0; if(d==x){ if(sum==y){ return 1; }else{ return 0; } } for(int j=n;j<=9;j++){ a+=mySet(d+1,sum+j,j+1); } return a; } int main(void){ while(1){ cin>>x>>y; if(x==0&&y==0){ break; }else{ cout<<mySet(0,0,0)<<endl; } } return 0; }
a.cc:5:6: error: storage size of 'cnt' isn't known 5 | int cnt[]; | ^~~
s698283312
p00097
C++
#include<iostream> using namespace std; int memo[10][1001]; int solve(int n, int s, int p){ if(!n && !s) return 1; if(n < 1 || s < 1) return 0; if(memo[n][s]) return memo[n][s]; int ans = 0; for(int i=p;i<101;i++) ans += solve(n-1, s-i, i+1); return memo[n][s] = ans; } int main(){ int n, s; while(true){ cin >> n >> s; if(!n && !s) break; memset(memo, 0, sizeof(memo)); cout << solve(n, s, 0) << endl; } }
a.cc: In function 'int main()': a.cc:25:5: error: 'memset' was not declared in this scope 25 | memset(memo, 0, sizeof(memo)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 | using namespace std;
s807961407
p00097
C++
#include <cstring> #include <iostream> #include <algorithm> using namespace std; long long memo[101][10][1001]; // x以下からちょうどk個でsを作る long long solve(int x, int k, int s) { if(k == 0 && s == 0) return 1; if(s < 0) return 0; if(x < 0) return 0; if(k == 0) return 0; int &res = memo[x][k][s]; if(res != -1) return res; return res = solve(x - 1, k, s) + solve(x - 1, k - 1, s - x); } int main() { memset(memo, -1, sizeof(memo)); while(true) { int n, s; cin >> n >> s; if(n == 0 && s == 0) break; cout << solve(100, n, s) << endl; } }
a.cc: In function 'long long int solve(int, int, int)': a.cc:15:26: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int' 15 | int &res = memo[x][k][s]; | ~~~~~~~~~~~~^
s029638473
p00097
C++
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <vector> #include <string> #include <map> #include <set> #include <queue> #include <stack> #include <algorithm> using namespace std; #define rep(i,j) REP((i), 0, (j)) #define REP(i,j,k) for(int i=(j);(i)<(k);++i) #define between(a,x,b) ((a)<=(x)&&(x)<=(b)) #define F first #define S second #define INF 1 << 30 int dp[10][1001]; int main(){ dp[0][0] = 1; for(int k = 0; k <= 100; ++k){ // for(int i = 0; i < 9; ++i){ for(int j = 1000; j >= 0; --j){ for(int i = 9; i > 0; --i){ if( j - k < 0) break; dp[i][j] += dp[i-1][j-k]; // printf("%d %d %d %d", i, j, k, dp[i][j]); } } } int n, s; while(scanf("%d%d", &n, &s) && n+s) printf("%d\n", dp[n][s]);
a.cc: In function 'int main()': a.cc:41:30: error: expected '}' at end of input 41 | printf("%d\n", dp[n][s]); | ^ a.cc:25:11: note: to match this '{' 25 | int main(){ | ^
s040741658
p00098
C
#include <stdio.h> #define max(a,b) (a)>(b) ? (a):(b); int n; int a[100][100]; long psum[100][100][100]; main(){ int i,j,k,l; long maxsum; int t1; scanf("%d",&n); for(i=0;i<n;i++) for(j=0;j<n;j++) scanf("%d",&a[i][j]); maxsum=psum[0][0][0]=a[0][0]; for(l=1;l<n;l++){ psum[0][0][l]=psum[0][0][l-1]+a[0][l]; maxsum=max(maxsum,psum[0][0][l]); } for(k=1;k<n;k++){ t1=0; for(l=0;l<n;l++){ psum[0][k][l]=psum[0][k-1][l]; t1+=a[k][l]; psum[0][k][l]+=t1; maxsum=max(maxsum,psum[0][k][l]) } } for(j=1;j<n;j++) t1=0; for(k=0;k<n;k++){ t1+=a[j-1][k]; for(l=j;l<n;l++){ psum[j][k][l]=psum[j-1][k][l]; psum[j][k][l]-=t1; maxsum=max(maxsum,psum[j][k][l]); } } for(i=1;i<n;i++){ t1=0; for(j=0;j<n;j++,t1+=a[i-1][j-1]){ for(k=i;k<n;k++){ t2=0; for(l=j;l<n;l++){ t2+=a[i-1][l] psum[j][k][l]-=t2-t1; maxsum=max(maxsum,psum[j][k][l]); } } } } printf("%d\n",maxsum); return 0; }
main.c:6:1: error: return type defaults to 'int' [-Wimplicit-int] 6 | main(){ | ^~~~ main.c: In function 'main': main.c:46:33: error: 't2' undeclared (first use in this function); did you mean 't1'? 46 | t2=0; | ^~ | t1 main.c:46:33: note: each undeclared identifier is reported only once for each function it appears in main.c:48:54: error: expected ';' before 'psum' 48 | t2+=a[i-1][l] | ^ | ; 49 | psum[j][k][l]-=t2-t1; | ~~~~
s245274431
p00098
C++
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s062097019
p00098
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; class SumOf2DArray { private: vector<vector<int> > a; vector<vector<ll> > S; int N_, M_; void precalc() { for(int i=0; i<N_; i++) for(int j=0; j<M_; j++) S[i+1][j+1] = S[i+1][j] + a[i][j]; for(int i=0; i<N_; i++) for(int j=0; j<M_; j++) S[i+1][j+1] += S[i][j+1]; } public: SumOf2DArray(const vector<vector<int> >& a) { N_ = a.size(); M_ = a[0].size(); this->a = a; this->S.assign(N_+1, vector<ll>(M_+1, 0)); precalc(); } /* a[i][j] -> a[k][l] の和を求める。 戻り値:long long */ ll sum(int i, int j, int k, int l) { return S[k+1][l+1]-S[k+1][j]-S[i][l+1]+S[i][j]; } /* 長方形区間の最大の和を求める。O(N^4) */ ll maxSum() { ll res = LLONG_MIN; for(int i=0; i<N_; i++) for(int j=0; j<M_; j++) for(int k=i; k<N_; k++) for(int l=j; l<M_; l++) res = max(res, sum(i, j, k, l)); return res; } }; int main() { int N; cin >> N; vector<vector<int> > a; a.resize(N, vector<int>(N)); for(int i=0; i<N; i++) for(int j=0; j<N; j++) cin >> a[i][j]; SumOf2DArray s(a); cout << s.maxSum() << endl; return 0; }
a.cc: In member function 'll SumOf2DArray::maxSum()': a.cc:46:14: error: 'LLONG_MIN' was not declared in this scope 46 | ll res = LLONG_MIN; | ^~~~~~~~~ a.cc:4:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 3 | #include <algorithm> +++ |+#include <climits> 4 | using namespace std;
s004342135
p00098
C++
#include<iostream> using namespace std; #define rep(i,n) for(ll i=0;i<(ll)(n);i++) int main(){ int n; while(cin>>n){ if(n==0)break; int data[101][101]; rep(i,n){ rep(j,n){ cin>>data[i][j]; } } int ans=-999999999; rep(i,n){ rep(j,n){ int dp[101][101]; rep(k,101)rep(l,101)dp[k][l]=-999999999; dp[i][j]=data[i][j]; for(int k=i;k<n;k++){ for(int l=j;l<n;l++){ if(l+1<n){ int right=0; for(int loop=i;loop<=k;loop++) right+=data[loop][l+1]; dp[k][l+1]=dp[k][l]+right; } if(k+1<n){ int under=0; for(int loop=j;loop<=l;loop++) under+=data[k+1][loop]; dp[k+1][l]=dp[k][l]+under; } if(l+1<n && k+1<n) dp[k+1][l+1]=dp[k][l+1]+dp[k+1][l]-dp[k][l]+data[k+1][l+1]; } } for(int k=i;k<n;k++)for(int l=j;l<n;l++){ ans=max(ans,dp[k][l]); } } } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:6:22: error: 'll' was not declared in this scope 6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++) | ^~ a.cc:13:17: note: in expansion of macro 'rep' 13 | rep(i,n){ | ^~~ a.cc:13:21: error: 'i' was not declared in this scope 13 | rep(i,n){ | ^ a.cc:6:29: note: in definition of macro 'rep' 6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++) | ^ a.cc:14:29: error: expected ';' before 'j' 14 | rep(j,n){ | ^ a.cc:6:25: note: in definition of macro 'rep' 6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++) | ^ a.cc:14:29: error: 'j' was not declared in this scope 14 | rep(j,n){ | ^ a.cc:6:29: note: in definition of macro 'rep' 6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++) | ^ a.cc:6:22: error: 'll' was not declared in this scope 6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++) | ^~ a.cc:21:17: note: in expansion of macro 'rep' 21 | rep(i,n){ | ^~~ a.cc:21:21: error: 'i' was not declared in this scope 21 | rep(i,n){ | ^ a.cc:6:29: note: in definition of macro 'rep' 6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++) | ^ a.cc:22:29: error: expected ';' before 'j' 22 | rep(j,n){ | ^ a.cc:6:25: note: in definition of macro 'rep' 6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++) | ^ a.cc:22:29: error: 'j' was not declared in this scope 22 | rep(j,n){ | ^ a.cc:6:29: note: in definition of macro 'rep' 6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++) | ^ a.cc:24:37: error: expected ';' before 'k' 24 | rep(k,101)rep(l,101)dp[k][l]=-999999999; | ^ a.cc:6:25: note: in definition of macro 'rep' 6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++) | ^ a.cc:24:37: error: 'k' was not declared in this scope 24 | rep(k,101)rep(l,101)dp[k][l]=-999999999; | ^ a.cc:6:29: note: in definition of macro 'rep' 6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++) | ^ a.cc:24:47: error: expected ';' before 'l' 24 | rep(k,101)rep(l,101)dp[k][l]=-999999999; | ^ a.cc:6:25: note: in definition of macro 'rep' 6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++) | ^ a.cc:24:47: error: 'l' was not declared in this scope 24 | rep(k,101)rep(l,101)dp[k][l]=-999999999; | ^ a.cc:6:29: note: in definition of macro 'rep' 6 | #define rep(i,n) for(ll i=0;i<(ll)(n);i++) | ^
s261802426
p00098
C++
#include<iostream> using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) int main(){ int n; while(cin>>n){ if(n==0)break; int data[101][101]; rep(i,n){ rep(j,n){ cin>>data[i][j]; } } int ans=-999999999; rep(i,n){ rep(j,n){ int dp[101][101]; rep(k,101)rep(l,101)dp[k][l]=-999999999; dp[i][j]=data[i][j]; for(int k=i;k<n;k++){ for(int l=j;l<n;l++){ if(l+1<n){ int right=0; for(int loop=i;loop<=k;loop++) right+=data[loop][l+1]; dp[k][l+1]=dp[k][l]+right; ans=max(ans,dp[k][l+1]); } if(k+1<n){ int under=0; for(int loop=j;loop<=l;loop++) under+=data[k+1][loop]; dp[k+1][l]=dp[k][l]+under; ans=max(ans,dp[k+1][l]); } if(l+1<n && k+1<n){} dp[k+1][l+1]=dp[k][l+1]+dp[k+1][l]-dp[k][l]+data[k+1][l+1]; ans=max(ans,dp[k+1][l+1]); } } } } } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:49:23: error: 'ans' was not declared in this scope; did you mean 'abs'? 49 | cout<<ans<<endl; | ^~~ | abs a.cc: At global scope: a.cc:52:9: error: expected unqualified-id before 'return' 52 | return 0; | ^~~~~~ a.cc:53:1: error: expected declaration before '}' token 53 | } | ^
s091344437
p00098
C++
int main() { int n; cin >> n; cin.ignore(); long data[n][n]; for (int i = 0; i < n; i++) { string strRow = ""; getline(cin, strRow); vector<string> row = split(strRow, " "); for (int j = 0; j < row.size(); j++) { data[i][j] = stoi(row[j]); } } long max = -1000000000000; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { for (int k = i; k < n; k++) { for (int l = j; l < n; l++) { long sum = 0; for (int a = i; a <= k; a++) { for (int b = j; b <= l; b++) { sum += data[a][b]; } } max = sum > max ? sum : max; } } } } cout << max << endl; }
a.cc: In function 'int main()': a.cc:3:5: error: 'cin' was not declared in this scope 3 | cin >> n; cin.ignore(); | ^~~ a.cc:8:9: error: 'string' was not declared in this scope 8 | string strRow = ""; | ^~~~~~ a.cc:9:22: error: 'strRow' was not declared in this scope 9 | getline(cin, strRow); | ^~~~~~ a.cc:9:9: error: 'getline' was not declared in this scope 9 | getline(cin, strRow); | ^~~~~~~ a.cc:10:9: error: 'vector' was not declared in this scope 10 | vector<string> row = split(strRow, " "); | ^~~~~~ a.cc:10:24: error: 'row' was not declared in this scope 10 | vector<string> row = split(strRow, " "); | ^~~ a.cc:10:30: error: 'split' was not declared in this scope 10 | vector<string> row = split(strRow, " "); | ^~~~~ a.cc:12:26: error: 'stoi' was not declared in this scope 12 | data[i][j] = stoi(row[j]); | ^~~~ a.cc:34:6: error: 'cout' was not declared in this scope 34 | cout << max << endl; | ^~~~ a.cc:34:21: error: 'endl' was not declared in this scope 34 | cout << max << endl; | ^~~~
s345557128
p00098
C++
#include <cstdio> #include <algorithm> using namespace std; int n, a[100][100], sum[100][100]; int main() { scanf("%d", &n); for(int i = 0; i < n; i++) { for(int j = 0; j < n; i++) { cin >> a[i][j]; } } sum[0][0] = a[0][0]; for(int i = 1; i < n; i++) { sum[0][i] = sum[0][i - 1] + a[0][i]; sum[i][0] = sum[i - 1][0] + a[i][0]; } for(int i = 1; i < n; i++) { for(int j = 1; j < n; j++) { sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1]; } } int ret = -100000001; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { for(int k = i + 1; k <= n; k++) { for(int l = j + 1; l <= n; l++) { ret = max(ret, sum[k - 1][l - 1] + sum[i][j] - sum[i][l - 1] - sum[k - 1][j]; } } } } printf("%d\n", ret); return 0; }
a.cc: In function 'int main()': a.cc:16:13: error: 'cin' was not declared in this scope 16 | cin >> a[i][j]; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <algorithm> +++ |+#include <iostream> 3 | a.cc:46:97: error: expected ')' before ';' token 46 | ret = max(ret, sum[k - 1][l - 1] + sum[i][j] - sum[i][l - 1] - sum[k - 1][j]; | ~ ^ | )
s478152310
p00098
C++
#include <cstdio> #include <algorithm> using namespace std; int n, a[100][100], sum[100][100]; int main() { scanf("%d", &n); for(int i = 0; i < n; i++) { for(int j = 0; j < n; i++) { cin >> a[i][j]; } } sum[0][0] = a[0][0]; for(int i = 1; i < n; i++) { sum[0][i] = sum[0][i - 1] + a[0][i]; sum[i][0] = sum[i - 1][0] + a[i][0]; } for(int i = 1; i < n; i++) { for(int j = 1; j < n; j++) { sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1]; } } int ret = -100000001; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { for(int k = i + 1; k <= n; k++) { for(int l = j + 1; l <= n; l++) { ret = max(ret, sum[k - 1][l - 1] + sum[i][j] - sum[i][l - 1] - sum[k - 1][j]); } } } } printf("%d\n", ret); return 0; }
a.cc: In function 'int main()': a.cc:16:13: error: 'cin' was not declared in this scope 16 | cin >> a[i][j]; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <algorithm> +++ |+#include <iostream> 3 |
s808211693
p00098
C++
#include<iostream> using namespace std; int S[110][110] = { 0 }, a[110][110]; int main(){ int n,max=-50000,t; cin >> n; for (int i = 0; i < n; i++){ for (int j = 0; j < n; j++){ cin >> a[i][j]; S[i + 1][j + 1] = S[i][j + 1] + S[i + 1][j]; } } for (int i = 1; i <= n; i++){ for (int j = 1; j <= n; j++){ for (int k = 0; k < i; k++){ for (int h = 0; h < j; h++){ t = S[i][j] - S[k][j] - S[i][h] + S[k][h]; if (max ??? t)max = t; } } } } cout << t<<endl; }
a.cc: In function 'int main()': a.cc:21:50: error: expected primary-expression before '?' token 21 | if (max ??? t)max = t; | ^ a.cc:21:51: error: expected primary-expression before '?' token 21 | if (max ??? t)max = t; | ^ a.cc:21:54: error: expected ':' before ')' token 21 | if (max ??? t)max = t; | ^ | : a.cc:21:54: error: expected primary-expression before ')' token a.cc:21:54: error: expected ':' before ')' token 21 | if (max ??? t)max = t; | ^ | : a.cc:21:54: error: expected primary-expression before ')' token a.cc:21:54: error: expected ':' before ')' token 21 | if (max ??? t)max = t; | ^ | : a.cc:21:54: error: expected primary-expression before ')' token
s175925949
p00098
C++
#include<iostream> #include<algorithm> using namespace std; long long map[101][101]; int main(){ int n,a; cin>>n; for(int i=0;i<=n;i++)map[i][0]=0; for(int j=0;j<=n;j++)map[0][j]=0; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ cin>>a; map[i][j]=map[i-1][j]+map[i][j-1]-map[i-1][j-1]+a; } } int ans=0; for(int i=0;i<n;i++){ for(int is=i+1;is<=n;is++){ for(int j=0;j<n;j++){ for(int js=j+1;js<=n;js++){ ans=max(ans,map[is][js]-map[is][j]-map[i][js]+map[i][j]); } } } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:21:48: error: no matching function for call to 'max(int&, long long int)' 21 | ans=max(ans,map[is][js]-map[is][j]-map[i][js]+map[i][j]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:21:48: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 21 | ans=max(ans,map[is][js]-map[is][j]-map[i][js]+map[i][j]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:21:48: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 21 | ans=max(ans,map[is][js]-map[is][j]-map[i][js]+map[i][j]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s273194111
p00098
C++
#include<bits/stdc++.h> using namespace std; int map[101][101]; int main(){ int n,a; cin>>n; for(int i=0;i<=n;i++)map[i][0]=0; for(int j=0;j<=n;j++)map[0][j]=0; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ cin>>a; map[i][j]=map[i-1][j]+map[i][j-1]-map[i-1][j-1]+a; } } int ans=-1000000000; for(int i=0;i<n;i++){ for(int is=i+1;is<=n;is++){ for(int j=0;j<n;j++){ for(int js=j+1;js<=n;js++){ ans=max(ans,map[is][js]-map[is][j]-map[i][js]+map[i][j]); } } } } cout<<ans<<endl; getchar(); getchar(); return 0; }
a.cc: In function 'int main()': a.cc:7:30: error: reference to 'map' is ambiguous 7 | for(int i=0;i<=n;i++)map[i][0]=0; | ^~~ In file included from /usr/include/c++/14/map:63, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152, from a.cc:1: /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:8:30: error: reference to 'map' is ambiguous 8 | for(int j=0;j<=n;j++)map[0][j]=0; | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:12:25: error: reference to 'map' is ambiguous 12 | map[i][j]=map[i-1][j]+map[i][j-1]-map[i-1][j-1]+a; | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:12:35: error: reference to 'map' is ambiguous 12 | map[i][j]=map[i-1][j]+map[i][j-1]-map[i-1][j-1]+a; | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:12:47: error: reference to 'map' is ambiguous 12 | map[i][j]=map[i-1][j]+map[i][j-1]-map[i-1][j-1]+a; | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:12:59: error: reference to 'map' is ambiguous 12 | map[i][j]=map[i-1][j]+map[i][j-1]-map[i-1][j-1]+a; | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:20:53: error: reference to 'map' is ambiguous 20 | ans=max(ans,map[is][js]-map[is][j]-map[i][js]+map[i][j]); | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:20:65: error: reference to 'map' is ambiguous 20 | ans=max(ans,map[is][js]-map[is][j]-map[i][js]+map[i][j]); | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:20:76: error: reference to 'map' is ambiguous 20 | ans=max(ans,map[is][js]-map[is][j]-map[i][js]+map[i][j]); | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:20:87: error: reference to 'map' is ambiguous 20 | ans=max(ans,map[is][js]-map[is][j]-map[i][js]+map[i][j]); | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~
s827547821
p00098
C++
#include<bits/stdc++.h> using namespace std; int map[101][101]; int main(){ int n,a; cin>>n; for(int i=0;i<=n;i++)map[i][0]=0; for(int j=0;j<=n;j++)map[0][j]=0; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ cin>>a; map[i][j]=map[i-1][j]+map[i][j-1]-map[i-1][j-1]+a; } } int ans=-1000000000; for(int i=0;i<n;i++){ for(int is=i+1;is<=n;is++){ for(int j=0;j<n;j++){ for(int js=j+1;js<=n;js++){ ans=max(ans,map[is][js]-map[is][j]-map[i][js]+map[i][j]); } } } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:7:30: error: reference to 'map' is ambiguous 7 | for(int i=0;i<=n;i++)map[i][0]=0; | ^~~ In file included from /usr/include/c++/14/map:63, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152, from a.cc:1: /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:8:30: error: reference to 'map' is ambiguous 8 | for(int j=0;j<=n;j++)map[0][j]=0; | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:12:25: error: reference to 'map' is ambiguous 12 | map[i][j]=map[i-1][j]+map[i][j-1]-map[i-1][j-1]+a; | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:12:35: error: reference to 'map' is ambiguous 12 | map[i][j]=map[i-1][j]+map[i][j-1]-map[i-1][j-1]+a; | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:12:47: error: reference to 'map' is ambiguous 12 | map[i][j]=map[i-1][j]+map[i][j-1]-map[i-1][j-1]+a; | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:12:59: error: reference to 'map' is ambiguous 12 | map[i][j]=map[i-1][j]+map[i][j-1]-map[i-1][j-1]+a; | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:20:53: error: reference to 'map' is ambiguous 20 | ans=max(ans,map[is][js]-map[is][j]-map[i][js]+map[i][j]); | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:20:65: error: reference to 'map' is ambiguous 20 | ans=max(ans,map[is][js]-map[is][j]-map[i][js]+map[i][j]); | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:20:76: error: reference to 'map' is ambiguous 20 | ans=max(ans,map[is][js]-map[is][j]-map[i][js]+map[i][j]); | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~ a.cc:20:87: error: reference to 'map' is ambiguous 20 | ans=max(ans,map[is][js]-map[is][j]-map[i][js]+map[i][j]); | ^~~ /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [101][101]' 3 | int map[101][101]; | ^~~
s056481167
p00098
C++
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <stdio.h> #include <ctype.h> #include <string> #include <iostream> #include <vector> #include <stack> #include <fstream> #include <sstrea int mat[SIZE + 1][SIZE + 1] = { 0 }; int maxSumSeq(int* x, int len) { int mss, s; mss = s = 0; for (int i = 0; i < len; i++) { s += x[i]; if (s < 0) s = 0; if (mss < s) mss = s; } return mss; } void AOJ0098() { int n; cin >> n; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { cin >> mat[i][j]; } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { mat[i][j] += mat[i][j - 1]; } } for (int j = 1; j <= n; j++) { for (int i = 1; i <= n; i++) { mat[i][j] += mat[i - 1][j]; } } int maxSum = INT32_MIN; int sum; for (int i1 = 0; i1 < n; i1++) { for (int i2 = i1; i2 <= n; i2++) { for (int j1 = 0; j1 < n; j1++) { for (int j2 = 0; j2 <= n; j2++) { sum = mat[i2][j2] - mat[i1][j2] - mat[i2][j1] + mat[i1][j1]; if (maxSum < sum) maxSum = sum; } } } } cout << maxSum; return; } int main() { AOJ0098(); return 0; }
a.cc:11:17: error: missing terminating > character 11 | #include <sstrea | ^ a.cc:11:10: fatal error: sstrea: No such file or directory 11 | #include <sstrea | ^ compilation terminated.
s450308207
p00098
C++
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <stdio.h> #include <ctype.h> #include <string> #include <iostream> #include <vector> #include <stack> #include <fstream> #include <sstream> #include <queue> #include <exception> #include <cmath> #include <numeric> #define SIZE 100 using namespace std; typedef long long int lint; int mat[SIZE + 1][SIZE + 1] = { 0 }; int maxSumSeq(int* x, int len) { int mss, s; mss = s = 0; for (int i = 0; i < len; i++) { s += x[i]; if (s < 0) s = 0; if (mss < s) mss = s; } return mss; } void AOJ0098() { int n; cin >> n; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { cin >> mat[i][j]; } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { mat[i][j] += mat[i][j - 1]; } } for (int j = 1; j <= n; j++) { for (int i = 1; i <= n; i++) { mat[i][j] += mat[i - 1][j]; } } int maxSum = INT32_MIN; int sum; for (int i1 = 0; i1 < n; i1++) { for (int i2 = i1; i2 <= n; i2++) { for (int j1 = 0; j1 < n; j1++) { for (int j2 = 0; j2 <= n; j2++) { sum = mat[i2][j2] - mat[i1][j2] - mat[i2][j1] + mat[i1][j1]; if (maxSum < sum) maxSum = sum; } } } } cout << maxSum; return; } int main() { AOJ0098(); return 0; }
a.cc: In function 'void AOJ0098()': a.cc:61:22: error: 'INT32_MIN' was not declared in this scope 61 | int maxSum = INT32_MIN; | ^~~~~~~~~
s071992263
p00098
C++
#include<iostream> #include "fill.h" using namespace std; int A[100][100]={0}; int S[101][101]={0}; int main(){ Fill(A,0); Fill(S,0); int n; cin>>n; for(int i=0;i<n;++i){ for(int j=0;j<n;++j){ cin>>A[i][j]; } } for(int i=0;i<n;++i){ for(int j=0;j<n;++j){ int sum=0; for(int k=0;k<=i;++k){ for(int l=0;l<=j;++l){ sum+=A[k][l]; } } S[i+1][j+1]=sum; //cout<<sum<<" "; //for debug } } int maxsum=A[0][0]; for(int i=0;i<n;++i){ for(int j=0;j<n;++j){ for(int k=i+1;k<n+1;++k){ for(int l=j+1;l<n+1;++l){ int partsum=S[k][l]-S[k][j]-S[i][l]+S[i][j]; maxsum=(partsum>maxsum?partsum:maxsum); } } } } cout<<maxsum<<"\n"; }
a.cc:2:10: fatal error: fill.h: No such file or directory 2 | #include "fill.h" | ^~~~~~~~ compilation terminated.
s972383482
p00098
C++
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0098 TLE n=85だと通らない """ import sys from sys import stdin from functools import lru_cache input = stdin.readline def calc_points(n, array): # 右下から(x, y)までの長方形に含まれる値の和 global dp for y in range(n - 1, -1, -1): for x in range(n - 1, -1, -1): dp[y][x] = dp[y+1][x] + dp[y][x+1] - dp[y+1][x+1] + array[y][x] # @lru_cache(maxsize=None) def get_dp(y, x): return dp[y][x] def solve(n, array): ans = float('-inf') calc_points(n, array) for sy in range(n + 1): for sx in range(n + 1): for ey in range(sy+1, n + 1): for ex in range(sx+1, n + 1): s1 = get_dp(sy, sx) s2 = get_dp(sy, ex) s3 = get_dp(ey, sx) s4 = get_dp(ey, ex) s = s1 - s2 - s3 + s4 if s > ans: ans = s return ans dp = [[0] * (100 + 1) for _ in range(100 + 1)] def main(args): array = [] # n = 3 # array.append([1, -2, 3]) # array.append([-4, 5, 6]) # array.append([7, 8, -9]) n = int(input()) for _ in range(n): array.append([int(x) for x in input().split()]) ans = solve(n, array) print(ans) if __name__ == '__main__': main(sys.argv[1:])
a.cc:1:3: error: invalid preprocessing directive #- 1 | # -*- coding: utf-8 -*- | ^ a.cc:2:3: warning: missing terminating " character 2 | """ | ^ a.cc:2:3: error: missing terminating " character a.cc:5:3: warning: missing terminating " character 5 | """ | ^ a.cc:5:3: error: missing terminating " character a.cc:13:7: error: invalid preprocessing directive #\U000053f3\U00004e0b\U0000304b\U00003089 13 | # 右下から(x, y)までの長方形に含まれる値の和 | ^~~~~~~~ a.cc:20:3: error: invalid preprocessing directive #@ 20 | # @lru_cache(maxsize=None) | ^ a.cc:26:17: warning: multi-character character constant [-Wmultichar] 26 | ans = float('-inf') | ^~~~~~ a.cc:45:7: error: invalid preprocessing directive #n 45 | # n = 3 | ^ a.cc:46:7: error: invalid preprocessing directive #array 46 | # array.append([1, -2, 3]) | ^~~~~ a.cc:47:7: error: invalid preprocessing directive #array 47 | # array.append([-4, 5, 6]) | ^~~~~ a.cc:48:7: error: invalid preprocessing directive #array 48 | # array.append([7, 8, -9]) | ^~~~~ a.cc:58:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes 58 | if __name__ == '__main__': | ^~~~~~~~~~ a.cc:2:1: error: expected unqualified-id before string constant 2 | """ | ^~
s118521988
p00098
C++
// // main.cpp // Maximum Sum Sequence II // // Created by 八代 光平 on 13/04/24. // Copyright (c) 2013年 八代 光平. All rights reserved. // #include <iostream> #include <stdio.h> #include <stdlib.h> #define N 100 int sum(int top, int under, int left, int right, int a[N][N], int temp); //int search(int top, int under, int left, int right, int max, int a[N][N], int n); int main(int argc, const char * argv[]) { int n=0; scanf("%d",&n); int a[N][N]={0}; for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ scanf("%d",&a[i][j]); } } /*---------------*/ int max = a[0][0]; for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ for(int k=i; k<n; k++){ int l=j; int temp=0; while(l<n){ temp=sum(i, k, j, l, a); if(temp>max){ max=temp; }else if(temp<0){ l=n; } l++; } } } } /*---------------*/ printf("%d\n",max); } int sum(int top, int under, int left, int right, int a[N][N], int temp){ //int temp=0; for(int i=top; i<=under; i++){ //for(int j=left; j<=right; j++){ temp += a[i][right]; //} } //printf("%d,top:%d,under:%d,left:%d,right:%d\n",temp,top,under,left,right); return temp; }
a.cc: In function 'int main(int, const char**)': a.cc:39:29: error: too few arguments to function 'int sum(int, int, int, int, int (*)[100], int)' 39 | temp=sum(i, k, j, l, a); | ~~~^~~~~~~~~~~~~~~ a.cc:14:5: note: declared here 14 | int sum(int top, int under, int left, int right, int a[N][N], int temp); | ^~~
s478538002
p00099
Java
public static void main(String[] args) throws java.io.IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line; String[] nq = in.readLine().split(" "); int n= Integer.parseInt(nq[0]); int q= Integer.parseInt(nq[1]); String[] av; int a; int v; int[] hist = new int[n]; for(int i=0;i<n;i++){ hist[i]=0; } int top=1; int second=1; while ((line = in.readLine()) != null) { av = line.split(" "); a= Integer.parseInt(av[0]); v= Integer.parseInt(av[1]); hist[a-1]+=v; if(compare(a-1,top-1,hist)){ second =top; top = a; }else if(compare(second-1,top-1,hist)){ int tmp=top; top = second; second=tmp; } System.out.println(top+" "+hist[top-1]); } } private static boolean compare(int a, int b, int[] list){ if(list[a]>list[b]){ return true; }else if(list[a]==list[b]&&a<b){ return true; } return false; } }
Main.java:3: error: unnamed classes are a preview feature and are disabled by default. public static void main(String[] args) throws java.io.IOException { ^ (use --enable-preview to enable unnamed classes) Main.java:60: error: class, interface, enum, or record expected } ^ 2 errors
s645032779
p00099
Java
public static void main(String[] args) throws java.io.IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line; String[] nq = in.readLine().split(" "); int n= Integer.parseInt(nq[0]); int q= Integer.parseInt(nq[1]); String[] av; int a; int v; int[] hist = new int[n]; for(int i=0;i<n;i++){ hist[i]=0; } int top=1; int second=1; while ((line = in.readLine()) != null) { av = line.split(" "); a= Integer.parseInt(av[0]); v= Integer.parseInt(av[1]); hist[a-1]+=v; if(true){ second =top; top = a; }else if(true){ int tmp=top; top = second; second=tmp; } System.out.println(top+" "+hist[top-1]); } } }
Main.java:3: error: unnamed classes are a preview feature and are disabled by default. public static void main(String[] args) throws java.io.IOException { ^ (use --enable-preview to enable unnamed classes) Main.java:50: error: class, interface, enum, or record expected } ^ 2 errors
s857546701
p00099
Java
public static void main(String[] args) throws java.io.IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line; String[] nq = in.readLine().split(" "); int n= Integer.parseInt(nq[0]); int q= Integer.parseInt(nq[1]); String[] av; int a; int v; int[] hist = new int[n]; for(int i=0;i<n;i++){ hist[i]=0; } int top=1; int second=1; while ((line = in.readLine()) != null) { av = line.split(" "); a= Integer.parseInt(av[0]); v= Integer.parseInt(av[1]); hist[a-1]+=v; System.out.println(top+" "+hist[top-1]); } } }
Main.java:3: error: unnamed classes are a preview feature and are disabled by default. public static void main(String[] args) throws java.io.IOException { ^ (use --enable-preview to enable unnamed classes) Main.java:42: error: class, interface, enum, or record expected } ^ 2 errors
s820261520
p00099
Java
//Surf Smelt Fishing Contest II import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; class Main { public static void main(String[] args) throws java.io.IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line; String[] nq = in.readLine().split(" "); int n= Integer.parseInt(nq[0]); int q= Integer.parseInt(nq[1]); String[] av; int a; int v; int[] hist = new int[n]; for(int i=0;i<n;i++){ hist[i]=-1; } int top=0; int second=0; int count=0; while ((line = in.readLine()) != null) { av = line.split(" "); a= Integer.parseInt(av[0]); v= Integer.parseInt(av[1]); if(hist[a]==-1){ hist[a]++; } hist[a]+=v; // if(count==0||count==1){ if(true){ for(int i=0;i<n;i++){ if(compare(a,top,hist)){ second=top; top=a; } } }else{ if(compare(a,top,hist)){ second =top; top = a; }else if(top!=second&&compare(second,top,hist)){ int tmp=top; top = second; second=tmp; } } System.out.println((top+1)+" "+hist[top]); count++; } }
Main.java:66: error: reached end of file while parsing } ^ 1 error
s937385001
p00099
Java
//Surf Smelt Fishing Contest II import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; class Main { public static void main(String[] args) throws java.io.IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line; String[] nq = in.readLine().split(" "); int n= Integer.parseInt(nq[0]); int q= Integer.parseInt(nq[1]); String[] av; int a; int v; int[] hist = new int[n]; for(int i=0;i<n;i++){ hist[i]=-1; } int top=0; int second=0; int count=0; while ((line = in.readLine()) != null) { av = line.split(" "); a= Integer.parseInt(av[0])-1; v= Integer.parseInt(av[1]); if(hist[a]==-1){ hist[a]++; } hist[a]+=v; // if(count==0||count==1){ if(true){ for(int i=0;i<n;i++){ if(compare(a,top,hist)){ second=top; top=a; } } }else{ if(compare(a,top,hist)){ second =top; top = a; }else if(top!=second&&compare(second,top,hist)){ int tmp=top; top = second; second=tmp; } } System.out.println((top+1)+" "+hist[top]); count++; } }
Main.java:66: error: reached end of file while parsing } ^ 1 error
s042051047
p00099
Java
//Surf Smelt Fishing Contest II import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; class Main { public static void main(String[] args) throws java.io.IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line; String[] nq = in.readLine().split(" "); int n= Integer.parseInt(nq[0]); int q= Integer.parseInt(nq[1]); String[] av; int a; int v; int[] hist = new int[n]; for(int i=0;i<n;i++){ hist[i]=0; } int top=1; int second=1; int count=0; while ((line = in.readLine()) != null) { av = line.split(" "); a= Integer.parseInt(av[0]); v= Integer.parseInt(av[1]); hist[a-1]+=v; top=1; for(int i=0;i<n;i++){ if(compare(i,top-1,hist)){ second=top; top=i; } } //// if(count==0||count==1){ // if(true){ // for(int i=0;i<n;i++){ // if(compare(a,top,hist)){ // second=top; // top=a; // } // } // }else{ // // if(compare(a,top,hist)){ // second =top; // top = a; // }else if(top!=second&&compare(second,top,hist)){ // int tmp=top; // top = second; // second=tmp; // } // } System.out.println(top+" "+hist[top-1]); count++; } }
Main.java:71: error: reached end of file while parsing } ^ 1 error
s883422082
p00099
Java
//Surf Smelt Fishing Contest II import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; class Main { public static void main(String[] args) throws java.io.IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line; String[] nq = in.readLine().split(" "); int n= Integer.parseInt(nq[0]); int q= Integer.parseInt(nq[1]); String[] av; int a; int v; int[] hist = new int[n]; for(int i=0;i<n;i++){ hist[i]=0; } int top=1; int second=1; int count=0; while ((line = in.readLine()) != null) { av = line.split(" "); a= Integer.parseInt(av[0]); v= Integer.parseInt(av[1]); hist[a-1]+=v; //// if(count==0||count==1){ // if(true){ // for(int i=0;i<n;i++){ // if(compare(a,top,hist)){ // second=top; // top=a; // } // } // }else{ // // if(compare(a,top,hist)){ // second =top; // top = a; // }else if(top!=second&&compare(second,top,hist)){ // int tmp=top; // top = second; // second=tmp; // } // } System.out.println(top+" "+hist[top-1]); count++; } }
Main.java:64: error: reached end of file while parsing } ^ 1 error
s224320730
p00099
Java
//Surf Smelt Fishing Contest II import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; class Main { public static void main(String[] args) throws java.io.IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line; String[] nq = in.readLine().split(" "); int n= Integer.parseInt(nq[0]); int q= Integer.parseInt(nq[1]); String[] av; int a; int v; int[] hist = new int[n]; for(int i=0;i<n;i++){ hist[i]=0; } int top=1; int second=1; int count=0; while ((line = in.readLine()) != null) { av = line.split(" "); a= Integer.parseInt(av[0]); v= Integer.parseInt(av[1]); //// if(count==0||count==1){ // if(true){ // for(int i=0;i<n;i++){ // if(compare(a,top,hist)){ // second=top; // top=a; // } // } // }else{ // // if(compare(a,top,hist)){ // second =top; // top = a; // }else if(top!=second&&compare(second,top,hist)){ // int tmp=top; // top = second; // second=tmp; // } // } System.out.println(top+" "+hist[top-1]); count++; } }
Main.java:64: error: reached end of file while parsing } ^ 1 error
s616542218
p00099
Java
//Surf Smelt Fishing Contest II import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; class Main { public static void main(String[] args) throws java.io.IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line; String[] nq = in.readLine().split(" "); int n= Integer.parseInt(nq[0]); int q= Integer.parseInt(nq[1]); String[] av; int a; int v; int[] hist = new int[n]; for(int i=0;i<n;i++){ hist[i]=0; } int top=1; int second=1; int count=0; while ((line = in.readLine()) != null) { av = line.split(" "); a= Integer.parseInt(av[0]); v= Integer.parseInt(av[1]); //// if(count==0||count==1){ // if(true){ // for(int i=0;i<n;i++){ // if(compare(a,top,hist)){ // second=top; // top=a; // } // } // }else{ // // if(compare(a,top,hist)){ // second =top; // top = a; // }else if(top!=second&&compare(second,top,hist)){ // int tmp=top; // top = second; // second=tmp; // } // } } }
Main.java:63: error: reached end of file while parsing } ^ 1 error
s310341846
p00099
Java
//Surf Smelt Fishing Contest II import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; class Main { public static void main(String[] args) throws java.io.IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line; String[] nq = in.readLine().split(" "); int n= Integer.parseInt(nq[0]); int q= Integer.parseInt(nq[1]); String[] av; int a; int v; int[] hist = new int[n]; for(int i=0;i<n;i++){ hist[i]=0; } int top=1; int second=1; int count=0; while ((line = in.readLine()) != null) { av = line.split(" "); a= Integer.parseInt(av[0]); v= Integer.parseInt(av[1]); } }
Main.java:41: error: reached end of file while parsing } ^ 1 error
s820941388
p00099
Java
//Surf Smelt Fishing Contest II import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; class Main { public static void main(String[] args) throws java.io.IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line; String[] nq = in.readLine().split(" "); int n= Integer.parseInt(nq[0]); int q= Integer.parseInt(nq[1]); String[] av; int a; int v; int[] hist = new int[n]; for(int i=0;i<n;i++){ hist[i]=0; } int top=1; int second=1; int count=0; }
Main.java:34: error: reached end of file while parsing } ^ 1 error
s288560882
p00099
Java
//Surf Smelt Fishing Contest II import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; class Main { public static void main(String[] args) throws java.io.IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line; String[] nq = in.readLine().split(" "); int n= Integer.parseInt(nq[0]); int q= Integer.parseInt(nq[1]); String[] av; int a; int v; int top=1; int second=1; int count=0; }
Main.java:30: error: reached end of file while parsing } ^ 1 error
s403928881
p00099
Java
//Surf Smelt Fishing Contest II import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; class Main { public static void main(String[] args) throws java.io.IOException { String[] av; int a; int v; int top=1; int second=1; int count=0; }
Main.java:24: error: reached end of file while parsing } ^ 1 error
s592071974
p00099
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Comparator; import java.util.PriorityQueue; import java.util.Queue; /** * Surf Smelt Fishing Contest II */ public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line; String[] words; P0099 main = new P0099(); while ((line = br.readLine()) != null && !line.isEmpty()) { int n = Integer.parseInt(line.substring(0, line.indexOf(' '))); int q = Integer.parseInt(line.substring(line.indexOf(' ') + 1)); Angler[] anglers = new Angler[n + 1]; for (int i = 1; i <= n; i++) { anglers[i] = main.new Angler(i); } Queue<Angler> pq = new PriorityQueue<>(new Comparator<Angler>() { @Override public int compare(Angler o1, Angler o2) { if (o1.catch_ == o2.catch_) { return Integer.compare(o1.id, o2.id); } else { return Integer.compare(o2.catch_, o1.catch_); } } }); StringBuilder sb = new StringBuilder(); for (int i = 0; i < q; i++) { line = br.readLine(); int a, v; a = Integer.parseInt(line.substring(0, line.indexOf(' '))); v = Integer.parseInt(line.substring(line.indexOf(' ') + 1)); pq.remove(anglers[a]); anglers[a].catch_ += v; pq.add(anglers[a]); // sb.append(pq.peek().id + " " + pq.peek().catch_ + "\n"); } System.out.print(sb.toString()); } //end while } //end main class Angler { int id; int catch_ = 0; Angler(int id) { this.id = id; } } }
Main.java:18: error: cannot find symbol P0099 main = new P0099(); ^ symbol: class P0099 location: class Main Main.java:18: error: cannot find symbol P0099 main = new P0099(); ^ symbol: class P0099 location: class Main 2 errors
s139176568
p00099
Java
//Volume0-0099 import java.util.*; public class Main_02 { public static void main(String[] args) { int n,q,a,v,top; int[] sum; Scanner sc = new Scanner(System.in); n = sc.nextInt(); sum = new int[n+2]; top = n+1; sum[top] = Integer.MIN_VALUE; q = sc.nextInt(); for(int i=0;i<q;i++){ a = sc.nextInt(); v = sc.nextInt(); sum[a] += v; if(v<0&&a==top){ sum[top] = Integer.MIN_VALUE;; top = n+1; for(int j=1;j<=n;j++){ if(sum[j]>sum[top]){ sum[top] = sum[j]; top=j; } else if (sum[j]==sum[top] && j<top){ top=j; } } } else { if((sum[a] > sum[top]) || (sum[a] == sum[top] && a < top)){ top = a; } } System.out.println(top+" "+sum[top]); } } }
Main.java:4: error: class Main_02 is public, should be declared in a file named Main_02.java public class Main_02 { ^ 1 error
s932791878
p00099
C
#include <stdio.h> void array_clear(int pep[],int num){ int i; for(i=1;i<=n;i++){ pep[i]=0; } } int main(void){ int pep[1000000]; int n,q; int i; int a,v; int maxa,maxv; scanf("%d%d",&n,&q); array_clear(pep,n); maxa=0; maxv=-1; for(i=0;i<q;i++){ scanf("%d%d",&a,&v); pep[a] += v; if(maxv < pep[a]){ maxa=a; maxv=v; } printf("%d %d\n",maxa,maxv); } return 0; }
main.c: In function 'array_clear': main.c:6:14: error: 'n' undeclared (first use in this function) 6 | for(i=1;i<=n;i++){ | ^ main.c:6:14: note: each undeclared identifier is reported only once for each function it appears in
s486159082
p00099
C
for(i=0;i<=n;i++){f[i]=0;prev[i]=0;next[i]=0;} for(i=0;i<9000;i++)vv[i]=0; for(;q>0;q--){ scanf("%d %d",&a,&v); x=f[a]; if(x>0){ if(vv[x]==a){ if(next[a]>0){vv[x]=next[a];} else vv[x]=0; } next[prev[a]]=next[a]; prev[next[a]]=prev[a]; prev[0]=0;next[0]=0; } f[a]+=v;x+=v; if(x>0){ if(a<vv[x] || vv[x]==0){ /*prev[a]=0; next[a]=vv[x]; prev[vv[x]]=a; prev[0]=0; vv[x]=a;*/ } else{ /*i=vv[x]; while(a<next[i] || next[i]>0)i=next[i]; prev[a]=i; next[a]=next[i]; prev[next[i]]=a; next[i]=a; prev[0]=0;*/ } }else{prev[a]=0;next[a]=0;} if(v>0){if(x>vvv || (x==vvv && a<aaa)){vvv=x;aaa=a;}} else if(a==aaa){ /*for(i=vvv;vv[i]<1 && i>0;i--);*/ if(i==0){vvv=0;aaa=1;} else vvv=i;aaa=vv[i]; } printf("%d %d\n",aaa,vvv); } return 0; }
main.c:1:9: error: expected identifier or '(' before 'for' 1 | for(i=0;i<=n;i++){f[i]=0;prev[i]=0;next[i]=0;} | ^~~ main.c:1:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token 1 | for(i=0;i<=n;i++){f[i]=0;prev[i]=0;next[i]=0;} | ^~ main.c:1:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token 1 | for(i=0;i<=n;i++){f[i]=0;prev[i]=0;next[i]=0;} | ^~ main.c:2:9: error: expected identifier or '(' before 'for' 2 | for(i=0;i<9000;i++)vv[i]=0; | ^~~ main.c:2:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 2 | for(i=0;i<9000;i++)vv[i]=0; | ^ main.c:2:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token 2 | for(i=0;i<9000;i++)vv[i]=0; | ^~ main.c:3:9: error: expected identifier or '(' before 'for' 3 | for(;q>0;q--){ | ^~~ main.c:3:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '>' token 3 | for(;q>0;q--){ | ^ main.c:3:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '--' token 3 | for(;q>0;q--){ | ^~ main.c:48:9: error: expected identifier or '(' before 'return' 48 | return 0; | ^~~~~~ main.c:49:1: error: expected identifier or '(' before '}' token 49 | } | ^
s709352797
p00099
C
#include <stdio.h> #include <assert.h> int main(void){ int i,x,n,q,a,v,aaa=0,vvv=0,vv[9000],f[1000001],next[1000001],prev[1000001]; scanf("%d %d",&n,&q); for(i=0;i<=1000000;i++){f[i]=0;prev[i]=0;next[i]=0;}assert(false); for(i=0;i<9000;i++)vv[i]=0; for(i=0;i<=n;i++)printf("%d %d %d\n",f[i],prev[i],next[i]); for(i=0;i<9000;i++)printf("%d\n",vv[i]); /* for(;q>0;q--){ scanf("%d %d",&a,&v); x=f[a]; if(x>0){ if(vv[x]==a){ if(next[a]>0){vv[x]=next[a];} else vv[x]=0; } next[prev[a]]=next[a]; prev[next[a]]=prev[a]; prev[0]=0;next[0]=0; } f[a]+=v;x+=v; if(x>0){ if(a<vv[x] || vv[x]==0){ prev[a]=0; next[a]=vv[x]; prev[vv[x]]=a; prev[0]=0; vv[x]=a; } else{ i=vv[x]; fprintf(stderr,"%d\n",i); while(a>next[i] && next[i]>0){i=next[i];assert(i>0);} prev[a]=i; next[a]=next[i]; prev[next[i]]=a; next[i]=a; prev[0]=0; assert(0); } }else{prev[a]=0;next[a]=0;} if(v>0){if(x>vvv || (x==vvv && a<aaa)){vvv=x;aaa=a;}} else if(a==aaa){ for(i=vvv; vv[i]<1 && i>0 ;i--){assert(i>0 && i<9000);} vvv=i; aaa=vv[i]; } printf("%d %d\n",aaa,vvv); } */ return 0; }
In file included from main.c:2: main.c: In function 'main': main.c:6:68: error: 'false' undeclared (first use in this function) 6 | for(i=0;i<=1000000;i++){f[i]=0;prev[i]=0;next[i]=0;}assert(false); | ^~~~~ main.c:3:1: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 2 | #include <assert.h> +++ |+#include <stdbool.h> 3 | int main(void){ main.c:6:68: note: each undeclared identifier is reported only once for each function it appears in 6 | for(i=0;i<=1000000;i++){f[i]=0;prev[i]=0;next[i]=0;}assert(false); | ^~~~~
s702274822
p00099
C
int main(void){ int i,x,n,q,a,v,aaa=0,vvv=0,vv[9000],f[1000001],prev[1000001],next[1000001]; scanf("%d %d",&n,&q); for(i=0;i<=n;i++){f[i]=0;prev[i]=0;next[i]=0;} for(i=0;i<9000;i++)vv[i]=0; for(;q>0;q--){ scanf("%d %d",&a,&v); x=f[a]; printf("%d\n",x); if(x>0){ if(vv[x]==a){ if(next[a]>0){vv[x]=next[a];} else vv[x]=0; } next[prev[a]]=next[a]; prev[next[a]]=prev[a]; prev[0]=0;next[0]=0; } f[a]+=v;x+=v; if(x>0){ if(a<vv[x] || vv[x]==0){ prev[a]=0; next[a]=vv[x]; prev[vv[x]]=a; prev[0]=0; vv[x]=a; } else{ i=vv[x]; while(a>next[i] && next[i]>0){fprintf(stderr,"%d\n",i);i=next[i];assert(i>0);} prev[a]=i; next[a]=next[i]; prev[next[i]]=a; next[i]=a; prev[0]=0; } }else{prev[a]=0;next[a]=0;} if(v>0){if(x>vvv || (x==vvv && a<aaa)){vvv=x;aaa=a;}} else if(a==aaa){ /*for(i=vvv; vv[i]<1 && i>0 ;i--){assert(i>0 && i<9000);} vvv=i; aaa=vv[i];*/ } printf("%d %d\n",aaa,vvv); } return 0; }
main.c: In function 'main': main.c:3:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 3 | scanf("%d %d",&n,&q); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | int main(void){ main.c:3:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 3 | scanf("%d %d",&n,&q); | ^~~~~ main.c:3:9: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:11:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 11 | printf("%d\n",x); | ^~~~~~ main.c:11:17: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:11:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:11:17: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:35:63: error: implicit declaration of function 'fprintf' [-Wimplicit-function-declaration] 35 | while(a>next[i] && next[i]>0){fprintf(stderr,"%d\n",i);i=next[i];assert(i>0);} | ^~~~~~~ main.c:35:63: note: include '<stdio.h>' or provide a declaration of 'fprintf' main.c:35:63: warning: incompatible implicit declaration of built-in function 'fprintf' [-Wbuiltin-declaration-mismatch] main.c:35:63: note: include '<stdio.h>' or provide a declaration of 'fprintf' main.c:35:71: error: 'stderr' undeclared (first use in this function) 35 | while(a>next[i] && next[i]>0){fprintf(stderr,"%d\n",i);i=next[i];assert(i>0);} | ^~~~~~ main.c:35:71: note: 'stderr' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>' main.c:35:71: note: each undeclared identifier is reported only once for each function it appears in main.c:35:98: error: implicit declaration of function 'assert' [-Wimplicit-function-declaration] 35 | while(a>next[i] && next[i]>0){fprintf(stderr,"%d\n",i);i=next[i];assert(i>0);} | ^~~~~~ main.c:1:1: note: 'assert' is defined in header '<assert.h>'; this is probably fixable by adding '#include <assert.h>' +++ |+#include <assert.h> 1 | int main(void){
s813908324
p00099
C
#include <stdio.h> int main(void) { int n,q,num,fish,i,j,vic=0,max=0,get[100]; scanf("%d %d",&n,&q); for(i=1;i<=n;i++){ get[i]=0; } for(i=0;i<q;i++){ scanf("%d %d",&num,&fish); get[0]+=fish; if(fish<0 && num) max=0; for(j=n;j>0;j--){ if(max<=get[j]){ max=get[j]; vic=j; } } else if(get[num]>max || (get[num]==max && vic>num)){ max=get[num]; vic=num; } printf("%d %d\n",vic,get[vic]); } return 0; }
main.c: In function 'main': main.c:23:17: error: 'else' without a previous 'if' 23 | else if(get[num]>max || (get[num]==max && vic>num)){ | ^~~~
s512164151
p00099
C
#include<stdio.h> int main(){ int n,q,i,j; scanf("%d %d",&n,&q); int top=0; int participant[n]; int x[q]; int y[q]; for(i=0;i<n;i++){ participant[i]=0; } for(i=0;i<q;i++){ int a,v; scanf("%d %d",&a,&v); participant[a-1]+=v; if(a-1!=top){ if(participant[top]<participant[a-1]){ top=a-1; }else{ top=0; for(j=1;j<n;j++){ if(participant[top]<participant[j]){ top=j; } } x[i]=top; y[i]=participant[top]; } for(i=0;i<q;i++){ printf("%d %d\n",x[i]+1,y[i]); } return 0; }
main.c: In function 'main': main.c:34:1: error: expected declaration or statement at end of input 34 | } | ^ main.c:34:1: error: expected declaration or statement at end of input
s813451148
p00099
C
n, q = gets.chomp.split(" ").map{|s| s.to_i} avs = [nil] + (1..n).map{|a| [a, 0]} avcache = {} max_a = 1 max_v = 0 q.times.each do a, v = gets.chomp.split(" ").map{|s| s.to_i} av0 = avs[a] v0 = (av0[1] += v) if v > 0 avcache[a] = av0 if avcache[a].nil? if max_v < v0 max_v = v0 max_a = a elsif max_v == v0 && max_a > a max_a = a end else avcache.delete(a) if v0 == 0 if max_a == a av1 = avcache.values.max{|a, b| a[1] <=> b[1] || b[0] <=> a[0]} max_a, max_v = av1 end end #p avs puts [max_a, max_v].join(" ") end
main.c:1:1: warning: data definition has no type or storage class 1 | n, q = gets.chomp.split(" ").map{|s| s.to_i} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int] main.c:1:4: error: type defaults to 'int' in declaration of 'q' [-Wimplicit-int] 1 | n, q = gets.chomp.split(" ").map{|s| s.to_i} | ^ main.c:1:8: error: 'gets' undeclared here (not in a function) 1 | n, q = gets.chomp.split(" ").map{|s| s.to_i} | ^~~~ main.c:1:33: error: expected ',' or ';' before '{' token 1 | n, q = gets.chomp.split(" ").map{|s| s.to_i} | ^ main.c:3:1: warning: data definition has no type or storage class 3 | avs = [nil] + (1..n).map{|a| [a, 0]} | ^~~ main.c:3:1: error: type defaults to 'int' in declaration of 'avs' [-Wimplicit-int] main.c:3:7: error: expected expression before '[' token 3 | avs = [nil] + (1..n).map{|a| [a, 0]} | ^ main.c:3:8: error: 'nil' undeclared here (not in a function) 3 | avs = [nil] + (1..n).map{|a| [a, 0]} | ^~~ main.c:3:16: error: too many decimal points in number 3 | avs = [nil] + (1..n).map{|a| [a, 0]} | ^~~~ main.c:4:1: warning: data definition has no type or storage class 4 | avcache = {} | ^~~~~~~ main.c:4:1: error: type defaults to 'int' in declaration of 'avcache' [-Wimplicit-int] main.c:6:1: error: expected ',' or ';' before 'max_a' 6 | max_a = 1 | ^~~~~ main.c:12:3: warning: data definition has no type or storage class 12 | av0 = avs[a] | ^~~ main.c:12:3: error: type defaults to 'int' in declaration of 'av0' [-Wimplicit-int] main.c:12:13: error: 'a' undeclared here (not in a function) 12 | av0 = avs[a] | ^ main.c:13:3: error: expected ',' or ';' before 'v0' 13 | v0 = (av0[1] += v) | ^~ main.c:27:7: warning: data definition has no type or storage class 27 | max_a, max_v = av1 | ^~~~~ main.c:27:7: error: type defaults to 'int' in declaration of 'max_a' [-Wimplicit-int] main.c:27:14: error: type defaults to 'int' in declaration of 'max_v' [-Wimplicit-int] 27 | max_a, max_v = av1 | ^~~~~ main.c:27:22: error: 'av1' undeclared here (not in a function); did you mean 'av0'? 27 | max_a, max_v = av1 | ^~~ | av0 main.c:28:5: error: expected ',' or ';' before 'end' 28 | end | ^~~ main.c:31:4: error: invalid preprocessing directive #p 31 | #p avs | ^
s362946508
p00099
C++
#include <iostream> #include <vector> #include <algorithm> #include <map> #define rep(i,n) for(int i=0;i<n;i++) using namespace std; long long int n[1000001]; int flag[1000001]; map<int,int> m; int main() { memset(n,0,sizeof(n)); memset(flag,0,sizeof(flag)); int num,_q; cin >> num >> _q; rep(i,_q) { int a,v; cin >> a >> v; n[a-1] += v; flag[a-1] = 1; long long int ans = n[0]; rep(j,1000001) { if(flag[j] == 1) ans = max(ans,n[j]); } vector<int> res; rep(j,1000001) { if(n[j] == ans) { res.push_back(j); } } sort(res.begin(),res.end()); cout << res[0]+1 << " " << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:15:9: error: 'memset' was not declared in this scope 15 | memset(n,0,sizeof(n)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include <map> +++ |+#include <cstring> 5 | #define rep(i,n) for(int i=0;i<n;i++)
s974827338
p00099
C++
#include <iostream> #include <cstdio> #include <algorithm> #define MAX_N 1000000 #define MAX_Q 100000 #define INF -1 using namespace std; struct Human { int no; int point; }; typedef struct Human Human; int compareTo(const Human a, const Human b) { return(a.point > b.point); } void output(int nowData[], int n) { Human nowData_cp[n + 1]; nowData_cp[0].no = INF; nowData_cp[0].point = INF; for(int r = 1; r <= n; r++) { nowData_cp[r].no = r; nowData_cp[r].point = nowData[r]; //printf("data: %d, %d", nowData_cp[r].no, nowData_cp[r].point); //printf("data: %d, %d", r, nowData[r]); } sort(nowData_cp, nowData_cp+n+1, compareTo); printf("%d %d\n", nowData_cp[0].no, nowData_cp[0].point); } int main(void) { int n, q; cin >> n >> q; int nowData[n + 1]; memset(nowData, 0, sizeof(nowData)); for(int r = 0; r < q; r++) { int no, point; cin >> no >> point; nowData[no] += point; output(nowData, n); } return(0); }
a.cc: In function 'int main()': a.cc:36:5: error: 'memset' was not declared in this scope 36 | memset(nowData, 0, sizeof(nowData)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 | #define MAX_N 1000000
s040246350
p00099
C++
#include <iostream> #include <queue> #include <cstdio> #define MAX_N 1000000 #define MAX_Q 100000 using namespace std; typedef pair<int, int> P; //番号, 匹数 int ary[MAX_N + 1]; int n, q; struct Greater { bool operator() (const P a, const P b) { if(a.first == b.first) { //匹数が同じなら return(a.second > b.second); //番号を昇順に } return(a.first < b.first); //同じでなければ匹数の降順に } }; priority_queue<P, vector<P>, Greater> data; //キューのデータをクリアする void clear() { while(!data.empty()) data.pop(); } void update(int no, int point) { ary[no] += point; //更新 if(data.size() > 0) clear(); //キューのデータ全消し //データを再度入れる for(int r = 1; r <= n; r++) { data.push(P(ary[r], r)); printf("data updated: %d, %d\n", r, ary[r]); } } int main(void) { cin >> n >> q; //initialize memset(ary, 0, sizeof(ary)); for(int r = 0; r < q; r++) { int no, point; cin >> no >> point; update(no, point); P top = data.top(); printf("%d %d\n", top.second, top.first); } return(0); }
a.cc: In function 'void clear()': a.cc:23:12: error: reference to 'data' is ambiguous 23 | while(!data.empty()) data.pop(); | ^~~~ In file included from /usr/include/c++/14/string:53, 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/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:19:39: note: 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, Greater> data' 19 | priority_queue<P, vector<P>, Greater> data; | ^~~~ a.cc:23:26: error: reference to 'data' is ambiguous 23 | while(!data.empty()) data.pop(); | ^~~~ /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:19:39: note: 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, Greater> data' 19 | priority_queue<P, vector<P>, Greater> data; | ^~~~ a.cc: In function 'void update(int, int)': a.cc:27:8: error: reference to 'data' is ambiguous 27 | if(data.size() > 0) clear(); //キューのデータ全消し | ^~~~ /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:19:39: note: 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, Greater> data' 19 | priority_queue<P, vector<P>, Greater> data; | ^~~~ a.cc:30:9: error: reference to 'data' is ambiguous 30 | data.push(P(ary[r], r)); | ^~~~ /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:19:39: note: 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, Greater> data' 19 | priority_queue<P, vector<P>, Greater> data; | ^~~~ a.cc: In function 'int main()': a.cc:39:5: error: 'memset' was not declared in this scope 39 | memset(ary, 0, sizeof(ary)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <cstdio> +++ |+#include <cstring> 4 | #define MAX_N 1000000 a.cc:44:17: error: reference to 'data' is ambiguous 44 | P top = data.top(); printf("%d %d\n", top.second, top.first); | ^~~~ /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:19:39: note: 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, Greater> data' 19 | priority_queue<P, vector<P>, Greater> data; | ^~~~
s978469296
p00099
C++
#include <iostream> using namespace std; int main() { int n, q; cin >> n >> q; int* fish = new int[n]; for (int i = 0; i < n; ++i) { fish[i] = 0; } for (; q; --q) { int a, v; cin >> a >> v; fish[a - 1] += v; int max = 0; for (int i = 0; i < n; ++i) { if (fish[max] < fish[i]) { max = i; } } cout << max + 1 << ' ' << fish[max] << endl; } delete[] fish; return 0; } int max = 0; for (int i = 0; i < n; ++i) { if (fish[max] < fish[i]) { max = i; } } cout << max + 1 << ' ' << fish[max] << endl; } delete[] fish; return 0; }
a.cc:32:17: error: expected unqualified-id before 'for' 32 | for (int i = 0; i < n; ++i) { | ^~~ a.cc:32:33: error: 'i' does not name a type 32 | for (int i = 0; i < n; ++i) { | ^ a.cc:32:40: error: expected unqualified-id before '++' token 32 | for (int i = 0; i < n; ++i) { | ^~ a.cc:37:17: error: 'cout' does not name a type 37 | cout << max + 1 << ' ' << fish[max] << endl; | ^~~~ a.cc:38:9: error: expected declaration before '}' token 38 | } | ^ a.cc:40:9: error: expected unqualified-id before 'delete' 40 | delete[] fish; | ^~~~~~ a.cc:41:9: error: expected unqualified-id before 'return' 41 | return 0; | ^~~~~~ a.cc:42:1: error: expected declaration before '}' token 42 | } | ^
s988322340
p00099
C++
#include <iostream> using namespace std; #define MAX_EVENT 100000 int main() { int n, q, a, v, max_id, max_fish = -1; cin >> n >> q; int* player_id = new int [MAX_EVENT]; int* player_fish = new int [MAX_EVENT]; int entry = 0; while(q--) { cin >> a >> v; auto v1 = v; for(int i = 0; i < entry; i++) { if(player_id[i] == a) { v1 = player_fish[i] += v; break;
a.cc: In function 'int main()': a.cc:16:23: error: expected '}' at end of input 16 | break; | ^ a.cc:14:35: note: to match this '{' 14 | if(player_id[i] == a) { | ^ a.cc:16:23: error: expected '}' at end of input 16 | break; | ^ a.cc:13:40: note: to match this '{' 13 | for(int i = 0; i < entry; i++) { | ^ a.cc:16:23: error: expected '}' at end of input 16 | break; | ^ a.cc:10:16: note: to match this '{' 10 | while(q--) { | ^ a.cc:16:23: error: expected '}' at end of input 16 | break; | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s870318065
p00099
C++
#include <iostream> #include <complex> #include <sstream> #include <string> #include <algorithm> #include <deque> #include <list> #include <map> #include <numeric> #include <queue> #include <vector> #include <set> #include <limits> #include <cstdio> #include <cctype> #include <cmath> #include <cstring> #include <cstdlib> #include <ctime> using namespace std; #define REP(i, j) for(int i = 0; i < (int)(j); ++i) #define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i) #define SORT(v) sort((v).begin(), (v).end()) #define REVERSE(v) reverse((v).begin(), (v).end()) typedef pair<int, int> P; const int MAX_N = 1000010; const int INF = INT_MAX; namespace std { bool operator > (const P& a, const P& b) { return a.first != b.first ? a.first > b.first : a.second < b.second; } } int N, Q; P v[2 * MAX_N - 1]; void init(int _n){ N = 1; while(N < _n) N *= 2; REP(i, 2 * N - 1) v[i] = P(0, 0); REP(i, _n) v[i + N - 1].second = i; } void update(int k, int a){ k += N - 1; v[k].first += a; while(k > 0){ k = (k - 1) / 2; v[k] = max(v[k * 2 + 1], v[k * 2 + 2]); } } int main() { cin >>N >>Q; init(N); REP(i, Q){ int a, b; cin >>a >>b; --a; update(a, b); cout <<v[0].second + 1 <<" " <<v[0].first <<endl; } return 0; }
a.cc:27:17: error: 'INT_MAX' was not declared in this scope 27 | const int INF = INT_MAX; | ^~~~~~~ a.cc:20:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 19 | #include <ctime> +++ |+#include <climits> 20 | using namespace std;
s697543301
p00099
C++
#include<stdio.h> #defin BB 1000001 int main(){ int n[BB][2]={}; int x,y,N,Q; int M,R; scanf("%d %d",&N,&Q); for(int i=0;i<Q;i++){ scanf("%d %d",&x,&y) n[x][0]+=y; if(i==0)M=x;R=y; if(n[x][0]>R){R=n[x][0];M=x;} else if(n[x][0]==R&&x<M){R=n[x][0];M=x;} printf("%d %d\n",M,R); } return 0; }
a.cc:2:2: error: invalid preprocessing directive #defin; did you mean #define? 2 | #defin BB 1000001 | ^~~~~ | define a.cc: In function 'int main()': a.cc:6:7: error: 'BB' was not declared in this scope 6 | int n[BB][2]={}; | ^~ a.cc:13:21: error: expected ';' before 'n' 13 | scanf("%d %d",&x,&y) | ^ | ; 14 | n[x][0]+=y; | ~ a.cc:16:4: error: 'n' was not declared in this scope 16 | if(n[x][0]>R){R=n[x][0];M=x;} | ^
s519403124
p00099
C++
#include<stdio.h> #define BB 1000001 int main(){ int n[BB][2]={}; int x,y,N,Q; int M,R; scanf("%d %d",&N,&Q); for(int i=0;i<Q;i++){ scanf("%d %d",&x,&y) n[x][0]+=y; if(i==0)M=x;R=y; if(n[x][0]>R){R=n[x][0];M=x;} else if(n[x][0]==R&&x<M){R=n[x][0];M=x;} printf("%d %d\n",M,R); } return 0; }
a.cc: In function 'int main()': a.cc:13:21: error: expected ';' before 'n' 13 | scanf("%d %d",&x,&y) | ^ | ; 14 | n[x][0]+=y; | ~
s613700751
p00099
C++
#include <iostream> #include<map> #include <stdio.h> #include <tchar.h> #include <cstdio> #include <algorithm> #include <queue> using namespace std; priority_queue<pair<int, int> > q; int n, m, d[1000001], a, b; int main(){ scanf_s("%d%d", &n, &m); q.push(make_pair(0, -1)); for(int i=0;i<m;i++){ scanf_s("%d%d", &a, &b); d[a] += b; q.push(make_pair(d[a], -a)); pair<int, int> p = q.top(); printf("%d %d\n", -p.second, p.first); } return 0; }
a.cc:4:10: fatal error: tchar.h: No such file or directory 4 | #include <tchar.h> | ^~~~~~~~~ compilation terminated.
s227221114
p00099
C++
#include <iostream> #include<map> #include <stdio.h> #include <tchar.h> #include <cstdio> #include <algorithm> #include <queue> using namespace std; priority_queue<pair<int, int> > q; int n, m, d[1000001], a, b; main(){ scanf_s("%d%d", &n, &m); q.push(make_pair(0, -1)); for(int i=0;i<m;i++){ scanf_s("%d%d", &a, &b); d[a] += b; q.push(make_pair(d[a], -a)); pair<int, int> p = q.top(); printf("%d %d\n", -p.second, p.first); } }
a.cc:4:10: fatal error: tchar.h: No such file or directory 4 | #include <tchar.h> | ^~~~~~~~~ compilation terminated.
s895985235
p00099
C++
#include <iostream> #include<map> #include <stdio.h> #include <tchar.h> #include <cstdio> #include <algorithm> #include <queue> using namespace std; priority_queue<pair<int, int> > q; int n, m, d[1000001], a, b; main(){ scanf("%d%d", &n, &m); q.push(make_pair(0, -1)); for(int i=0;i<m;i++){ scanf("%d%d", &a, &b); d[a] += b; q.push(make_pair(d[a], -a)); pair<int, int> p = q.top(); printf("%d %d\n", -p.second, p.first); } }
a.cc:4:10: fatal error: tchar.h: No such file or directory 4 | #include <tchar.h> | ^~~~~~~~~ compilation terminated.
s193436063
p00099
C++
#include <sstream> using namespace std; int find_max(int* arr, int size) { int max = -1; for (int i = 0; i < size; i++) { if (arr[max] < arr[i]) { max = i; } } return max; } int main() { int n, q; cin >> n >> q; int* m = (int*)malloc(sizeof(int) * n); for (int i = 0; i < n; i++) m[i] = 0; int max = -1; for (int i = 0; i < q; i++) { int a, v; cin >> a >> v; m[a - 1] += v; if (v > 0) { if (m[max] < m[a - 1]) { max = a - 1; } else if (m[max] == m[a-1]) { for (int j = 0; j < n; j++) { if (m[max] == m[j]) { max = j; break; } } } } else { max = find_max(m, n); } cout << max + 1 << " " << m[max] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:18:5: error: 'cin' was not declared in this scope 18 | cin >> n >> q; | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include <sstream> +++ |+#include <iostream> 2 | a.cc:45:9: error: 'cout' was not declared in this scope 45 | cout << max + 1 << " " << m[max] << endl; | ^~~~ a.cc:45:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s651518728
p00099
C++
#include<bits/stdc++.h> ui\/ p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£???
a.cc:2:3: error: stray '\' in program 2 | ui\/ | ^ a.cc:3:2: error: stray '@' in program 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:123: error: extended character ° is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:148: error: extended character £ is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:151: error: extended character £ is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:154: error: extended character £ is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:157: error: extended character £ is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:160: error: extended character £ is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:163: error: extended character £ is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:166: error: extended character £ is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:169: error: extended character £ is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:172: error: extended character £ is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:175: error: extended character £ is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:178: error: extended character £ is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:181: error: extended character £ is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:184: error: extended character £ is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:187: error: extended character £ is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:190: error: extended character £ is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:3:193: error: extended character £ is not valid in an identifier 3 | p@?????????p??????m????????????????????????bfcgcdsjbgvfdgm???l???j???????????????gfk???t??????????????????????????????????°?m???j??????h???????????£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??£??? | ^ a.cc:2:1: error: 'ui' does not name a type; did you mean 'uint'? 2 | ui\/ | ^~ | uint
s183365656
p00099
C++
#include <iostream> #include <stdio.h> #include <queue> using namespace std; typedef pair<int, int> P; void q99() { int n, q; for (; cin >> n >> q;) { //first??§???????????????????????????first??????second??§?????? auto comp = [](P l, P r) { return l.first != r.first ? l.first < r.first : l.second < r.second; }; priority_queue<P, vector<P>, decltype(comp) > queue(comp); int fish[100000]; memset(fish, 0, sizeof(fish)); for (int i = 0; i < q; i++) { int a_i, v_i; cin >> a_i >> v_i; fish[a_i] += v_i; queue.push(make_pair(fish[a_i], -a_i)); for (; !queue.empty();) { auto top = queue.top(); if (top.first == fish[-top.second]) { cout << -top.second << " " << top.first << endl; break; } queue.pop(); } } } } int main() { q99(); return 0; }
a.cc: In function 'void q99()': a.cc:16:17: error: 'memset' was not declared in this scope 16 | memset(fish, 0, sizeof(fish)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <queue> +++ |+#include <cstring> 4 | using namespace std;
s076965420
p00099
C++
#include <iostream> #include <stdio.h> #include <queue> using namespace std; typedef pair<int, int> P; void q99() { int n, q; for (; cin >> n >> q;) { //first??§???????????????????????????first??????second??§?????? auto comp = [](P l, P r) { return l.first != r.first ? l.first < r.first : l.second < r.second; }; priority_queue<P, vector<P>, decltype(comp) > queue(comp); int fish[100000]; memset(fish, 0, sizeof(fish)); for (int i = 0; i < q; i++) { int a_i, v_i; cin >> a_i >> v_i; fish[a_i] += v_i; queue.push(make_pair(fish[a_i], -a_i)); for (; !queue.empty();) { auto top = queue.top(); if (top.first == fish[-top.second]) { cout << -top.second << " " << top.first << endl; break; } queue.pop(); } } } } int main() { q99(); return 0; }
a.cc: In function 'void q99()': a.cc:16:17: error: 'memset' was not declared in this scope 16 | memset(fish, 0, sizeof(fish)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <queue> +++ |+#include <cstring> 4 | using namespace std;
s178799934
p00099
C++
#include <iostream> #include <queue> #include <string> using namespace std; typedef pair<int, int> P; int fish[100000]; //first??§???????????????????????????first??????second??§?????? auto comp = [](P l, P r) { return l.first != r.first ? l.first < r.first : l.second < r.second; }; void q99() { int n, q; for (; cin >> n >> q;) { priority_queue<P, vector<P>, decltype(comp) > queue(comp); memset(fish, 0, sizeof(fish)); for (int i = 0; i < q; i++) { int a_i, v_i; cin >> a_i >> v_i; fish[a_i] += v_i; queue.push(make_pair(fish[a_i], -a_i)); for (; !queue.empty();) { P top = queue.top(); if (top.first == fish[-top.second]) { cout << -top.second << " " << top.first << endl; break; } queue.pop(); } } } } int main() { q99(); return 0; }
a.cc: In function 'void q99()': a.cc:17:17: error: 'memset' was not declared in this scope 17 | memset(fish, 0, sizeof(fish)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <queue> +++ |+#include <cstring> 3 | #include <string>
s664672295
p00099
C++
#include <iostream> #include <queue> #include <string> using namespace std; typedef pair<int, int> P; int fish[100000]; //first??§???????????????????????????first??????second??§?????? auto comp = [](P l, P r) { return l.first != r.first ? l.first < r.first : l.second < r.second; }; void q99() { int n, q; for (; cin >> n >> q;) { priority_queue<P, vector<P>, decltype(comp) > queue(comp); memset(fish, 0, sizeof(fish)); for (int i = 0; i < q; i++) { int a_i, v_i; cin >> a_i >> v_i; fish[a_i] += v_i; queue.push(make_pair(fish[a_i], -a_i)); for (; !queue.empty();) { P top = queue.top(); if (top.first == fish[-top.second]) { cout << -top.second << " " << top.first << endl; break; } queue.pop(); } } } } int main() { q99(); return 0; }
a.cc: In function 'void q99()': a.cc:17:17: error: 'memset' was not declared in this scope 17 | memset(fish, 0, sizeof(fish)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <queue> +++ |+#include <cstring> 3 | #include <string>
s345349362
p00099
C++
#include <iostream> #include <stdio.h> #include <string.h> #include <string> #include <algorithm> #define min(a,b) {a > b ? b:a} using namespace std; long long int seg[1000000 * 2]; int id[1000000 * 2]; void q99() { int n, q; cin >> n >> q; for (int i = 0; i < N; i++) { id[i + N] = i; } for (int i = 0; i < q; i++) { int a, v; cin >> a >> v; segment[N + a - 1] += v; for (int j = (N + a - 1) >> 1; j > 0; j = j >> 1) { if (segment[j * 2] == segment[j * 2 + 1]) { segment[j] = segment[j * 2]; id[j] = min(id[j * 2], id[j * 2 + 1]); } else if (segment[j * 2] > segment[j * 2 + 1]) { segment[j] = segment[j * 2]; id[j] = id[j * 2]; } else { segment[j] = segment[j * 2 + 1]; id[j] = id[j * 2 + 1]; } } cout << id[1] + 1 << " " << segment[1] << endl; } } int main() { q99(); return 0; }
a.cc: In function 'void q99()': a.cc:16:29: error: 'N' was not declared in this scope 16 | for (int i = 0; i < N; i++) { | ^ a.cc:22:17: error: 'segment' was not declared in this scope 22 | segment[N + a - 1] += v; | ^~~~~~~ a.cc:22:25: error: 'N' was not declared in this scope 22 | segment[N + a - 1] += v; | ^
s599547377
p00099
C++
#include <iostream> #include <stdio.h> #include <string.h> #include <string> #include <algorithm> #define min(a,b) {a > b ? b:a} using namespace std; long long int segment[1000000 * 2]; int id[1000000 * 2]; void q99() { int n, q; cin >> n >> q; for (int i = 0; i < N; i++) { id[i + N] = i; } for (int i = 0; i < q; i++) { int a, v; cin >> a >> v; segment[N + a - 1] += v; for (int j = (N + a - 1) >> 1; j > 0; j = j >> 1) { if (segment[j * 2] == segment[j * 2 + 1]) { segment[j] = segment[j * 2]; id[j] = min(id[j * 2], id[j * 2 + 1]); } else if (segment[j * 2] > segment[j * 2 + 1]) { segment[j] = segment[j * 2]; id[j] = id[j * 2]; } else { segment[j] = segment[j * 2 + 1]; id[j] = id[j * 2 + 1]; } } cout << id[1] + 1 << " " << segment[1] << endl; } } int main() { q99(); return 0; }
a.cc: In function 'void q99()': a.cc:16:29: error: 'N' was not declared in this scope 16 | for (int i = 0; i < N; i++) { | ^ a.cc:22:25: error: 'N' was not declared in this scope 22 | segment[N + a - 1] += v; | ^
s569948139
p00099
C++
#include<stdio.h> using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;}
a.cc:2:21: error: 'priority_queue' does not name a type 2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;} | ^~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:2:85: error: 'cin' was not declared in this scope 2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;} | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include<stdio.h> +++ |+#include <iostream> 2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;} a.cc:2:109: error: 'p' was not declared in this scope 2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;} | ^ a.cc:2:116: error: 'make_pair' was not declared in this scope 2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;} | ^~~~~~~~~ a.cc:2:1: note: 'std::make_pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>' 1 | #include<stdio.h> +++ |+#include <utility> 2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;} a.cc:2:174: error: 'p' was not declared in this scope 2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;} | ^ a.cc:2:181: error: 'make_pair' was not declared in this scope 2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;} | ^~~~~~~~~ a.cc:2:181: note: 'std::make_pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>' a.cc:2:254: error: 'cout' was not declared in this scope 2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;} | ^~~~ a.cc:2:254: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:2:273: error: 'endl' was not declared in this scope 2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;} | ^~~~ a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 1 | #include<stdio.h> +++ |+#include <ostream> 2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;}
s561980731
p00099
C++
#include<iostream> using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;}
a.cc:2:21: error: 'priority_queue' does not name a type 2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;} | ^~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:2:109: error: 'p' was not declared in this scope 2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;} | ^ a.cc:2:174: error: 'p' was not declared in this scope 2 | using namespace std;priority_queue<pair<int,int> >p;int n,q,a,b,d[1<<20];int main(){cin>>n>>q;a=n;while(a--)p.push(make_pair(0,a)),d[a]=0;while(q--){cin>>a>>b;a=n-a,d[a]+=b;p.push(make_pair(d[a],a));while(1){a=p.top().first,b=p.top().second;if(d[b]==a){cout<<n-b<<" "<<a<<endl;break;}p.pop();}}return 0;} | ^
s818705445
p00099
C++
#include<iostream> using namespace std; int main(){ int n, q, a, v; int cnt[1000001]={}, x, ma; cin>>n>>q; for(int i=0;i<q;i++){ cin>>a>>v; cnt[a]+=v; ma=0; x=1; for(int j=1;j<=n;j++){ if(cnt[j]>ma){ ma=cnt[j]; x=j; }else if(cnt[j]==ma&&x>j) x=j; } cout<<x<<" "<<ma<<endl; }
a.cc: In function 'int main()': a.cc:22:4: error: expected '}' at end of input 22 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s511549669
p00099
C++
import sys def f(): w=m=0;n,q=map(int,input().split());s=[0]*-~n for e in sys.stdin: a,v=map(int,e.split());s[a]+=v if v<0 and a==w:m=max(s);w=s.index(m) elif s[a]>m:w,m=a,s[a] elif s[a]==m:w=min(w,a) print(w,m) f()
a.cc:1:1: error: 'import' does not name a type 1 | import sys | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:8: error: 'n' does not name a type 3 | w=m=0;n,q=map(int,input().split());s=[0]*-~n | ^ a.cc:3:37: error: 's' does not name a type 3 | w=m=0;n,q=map(int,input().split());s=[0]*-~n | ^ a.cc:5:26: error: 's' does not name a type 5 | a,v=map(int,e.split());s[a]+=v | ^ a.cc:6:28: error: 'w' does not name a type 6 | if v<0 and a==w:m=max(s);w=s.index(m) | ^
s271988656
p00099
C++
#include<iostream> #include<vector> using namespace std; int main() { int n, q, a, v; int maxA, maxV; cin>>n>>q; vector<int> list(n, 0); maxA = maxV = 0; while(cin>>a>>v) { a--; list[a] += v; if(v>0) { if(maxV < m[a]) { maxA = a; maxV = m[a]; } else if(maxV == m[a]) { maxA = min(maxA, a); } } if(v<0) { if(a == maxA) { maxV = -1; for(int i=0; i<n; i++) { if(maxV < list[i]) { maxA = i; maxV = list[i]; } } } } cout<<maxA+1<<" "<<maxV<<endl; } }
a.cc: In function 'int main()': a.cc:15:23: error: 'm' was not declared in this scope 15 | if(maxV < m[a]) { | ^
s354419877
p00099
C++
int main(){ int q,num,v,max,maxnum; maxnum = 0; cin >> n >> q; int wakasagi[10000]; max = wakasagi[0]; maxnum=0; for(int i=0;i<q;i++){ cin >> num >> v; wakasagi[num] += v; if(v < 0){ if(num == maxnum){ wsearch(&max,&maxnum,wakasagi); } } else if(v > 0){ if(num != maxnum){ wsearch(&max,&maxnum,wakasagi); } } cout << maxnum << " " << max<< endl; } }
a.cc: In function 'int main()': a.cc:7:9: error: 'cin' was not declared in this scope 7 | cin >> n >> q; | ^~~ a.cc:7:16: error: 'n' was not declared in this scope 7 | cin >> n >> q; | ^ a.cc:17:33: error: 'wsearch' was not declared in this scope 17 | wsearch(&max,&maxnum,wakasagi); | ^~~~~~~ a.cc:21:33: error: 'wsearch' was not declared in this scope 21 | wsearch(&max,&maxnum,wakasagi); | ^~~~~~~ a.cc:25:18: error: 'cout' was not declared in this scope 25 | cout << maxnum << " " << max<< endl; | ^~~~ a.cc:25:49: error: 'endl' was not declared in this scope 25 | cout << maxnum << " " << max<< endl; | ^~~~
s649947496
p00099
C++
if(f[B] == A) { cout << B << " " << A << endl; break; } else { pq.pop(); } } }
a.cc:3:7: error: expected unqualified-id before 'if' 3 | if(f[B] == A) { | ^~ a.cc:6:9: error: expected unqualified-id before 'else' 6 | } else { | ^~~~ a.cc:9:5: error: expected declaration before '}' token 9 | } | ^ a.cc:10:3: error: expected declaration before '}' token 10 | } | ^
s997868329
p00099
C++
// AOJ 0099 Surf Smelt Fishing Contest II #include <iostream> using namespace std; const int MAX_N = 1 << 20; int dat[2 * MAX_N - 1]; // 各節点に最大値を持つセグメント木 int n, n_dat, q; void dat_init(); void dat_set(int i, int x); void dat_add(int i, int x); bool dat_is_leaf(int i); pair<int, int> dat_max(); int main() { cin >> n; cin >> q; cin.ignore(); dat_init(); while (q--) { int a, v; pair<int, int> m; cin >> a; // 0-indexed にする a--; cin >> v; cin.ignore(); dat_add(a, v); // 獲得数が最も多い参加者の番号とその獲得数を出力する m = dat_max(); cout << m.first + 1 << " " << m.second << endl; } return 0; } // セグメント木の初期化 void dat_init() { int i; // 簡単のため、要素数を 2 の冪乗にする n_dat = 1; while (n_dat < n) n_dat *= 2; // 値の初期化 for (i = 0; i < 2 * n_dat - 1; i++) dat[i] = INT_MIN; for (i = 0; i < n; i++) dat_set(i, 0); } // i 番目の値を x にする void dat_set(int i, int x) { // 葉の節点 i += n_dat - 1; dat[i] = x; // 登りながら更新 while (i > 0) { i = (i - 1) / 2; dat[i] = max(dat[2 * i + 1], dat[2 * i + 2]); } } // i 番目の値に x を加算する void dat_add(int i, int x) { // 葉の節点 i += n_dat - 1; dat[i] += x; // 登りながら更新 while (i > 0) { i = (i - 1) / 2; dat[i] = max(dat[2 * i + 1], dat[2 * i + 2]); } } // 最大値とそれに対応する番号のペアを返す。 // 複数の i が同じ最大値に対応するならば、最小の i を返す。 pair<int, int> dat_max() { int i = 1; int j = 2; for (;;) { if (dat[i] >= dat[j]) { // 最大値が左に存在するか、左右で同じ if (dat_is_leaf(i)) return pair<int, int>(i - n_dat + 1, dat[i]); i = 2 * i + 1; } else { // 最大値が右に存在する if (dat_is_leaf(i)) return pair<int, int>(j - n_dat + 1 , dat[j]); i = 2 * j + 1; } j = i + 1; } } // 要素 i が葉かどうかを返す bool dat_is_leaf(int i) { return i >= n_dat - 1; }
a.cc: In function 'void dat_init()': a.cc:57:50: error: 'INT_MIN' was not declared in this scope 57 | for (i = 0; i < 2 * n_dat - 1; i++) dat[i] = INT_MIN; | ^~~~~~~ a.cc:4:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 3 | #include <iostream> +++ |+#include <climits> 4 |
s939345407
p00099
C++
#include<iostream> using namespace std; void f(int z){ for(int i=0;i<z;i++){ if(a[(z+i)*2][1]>=a[(z+i)*2+1][1]){ a[z+i][0]=a[(z+i)*2][0]; a[z+i][1]=a[(z+i)*2][1]; }else{ a[z+i][0]=a[(z+i)*2+1][0]; a[z+i][1]=a[(z+i)*2+1][1]; } } if(z!=1)f(z/2); } int main(){ int m,x,y,n; int a[3000000][2]={}; int q=0; cin>>n>>m; for(q=1;q<n;q=q*2){ } for(int i=1;i<=n;i++)a[i+q-1][0]=i; for(int i=0;i<m;i++){ cin>>x>>y; a[q+x-1][1]+=y; f(q/2); cout<<a[1][0]<<' '<<a[1][1]<<endl; } return 0; }
a.cc: In function 'void f(int)': a.cc:7:12: error: 'a' was not declared in this scope 7 | if(a[(z+i)*2][1]>=a[(z+i)*2+1][1]){ | ^
s815470122
p00099
C++
//J3で1番プログラミングと数学ができない奴のテストプログラム //aoj0099 #include<iostream> #include<vector> #include<algorithm> #define rep(i,n) for(i = 0;i < n;i++) #define F first #define S second typedef pair<int,int> P; using namespace std; class segtree{ P *a; //MAX_NUM,MAX_CNT int dep; //Length from root to leaf public: segtree(int depth,int x = 0){ int i; int size = (1 << (depth+1))-1; a = new P[size]; rep(i,size) a[i] = P(1,x); } ~segtree(){ delete[] a; } void add(int i,int x) { int index = (1 << dep)-1+i; int incnt = a[index].S + x; a[index] = P(index,incnt); while( index >= 0 ) { if( (a[index].S < incnt) || (a[index].S == incnt && a[index].F > i) ) a[index] = P( i,incnt ); index = (index-1) >> 1; } } P getmax(int i,int j) { if(i > j) swap(i,j); int index_l = (1 << dep)-1+i; int index_r = (1 << dep)-1+j; P ans; while( index_l < index_r ) { if( (a[index_l].S >= a[index_r].S) ) ans = a[index_l]; else ans = a[index_r]; index_l = ( (index_l-1) >> 1) +1; index_r = ( (index_r-1) >> 1) -1; } return ans; } } int main(){ segtree seg(20); int n,q,a,b; int i; cin >> n >> q; rep(i,q) { cin >> a >> b; seg.add( a,b ); cout << seg.getmax(1,n).F << " " << seg.getmax(1,n).S << endl; } return 0; }
a.cc:9:9: error: 'pair' does not name a type 9 | typedef pair<int,int> P; | ^~~~ a.cc:13:9: error: 'P' does not name a type 13 | P *a; //MAX_NUM,MAX_CNT | ^ a.cc:38:9: error: 'P' does not name a type 38 | P getmax(int i,int j) | ^ a.cc:57:2: error: expected ';' after class definition 57 | } | ^ | ; a.cc: In constructor 'segtree::segtree(int, int)': a.cc:19:17: error: 'a' was not declared in this scope 19 | a = new P[size]; | ^ a.cc:19:25: error: 'P' does not name a type 19 | a = new P[size]; | ^ a.cc:21:32: error: 'P' was not declared in this scope 21 | a[i] = P(1,x); | ^ a.cc: In destructor 'segtree::~segtree()': a.cc:24:26: error: 'a' was not declared in this scope 24 | delete[] a; | ^ a.cc: In member function 'void segtree::add(int, int)': a.cc:29:29: error: 'a' was not declared in this scope 29 | int incnt = a[index].S + x; | ^ a.cc:30:28: error: 'P' was not declared in this scope 30 | a[index] = P(index,incnt); | ^ a.cc: In function 'int main()': a.cc:67:29: error: 'class segtree' has no member named 'getmax' 67 | cout << seg.getmax(1,n).F << " " << seg.getmax(1,n).S << endl; | ^~~~~~ a.cc:67:57: error: 'class segtree' has no member named 'getmax' 67 | cout << seg.getmax(1,n).F << " " << seg.getmax(1,n).S << endl; | ^~~~~~
s527345766
p00099
C++
//J3で1番プログラミングと数学ができない奴のテストプログラム //aoj0099 #include<iostream> #include<vector> #include<algorithm> #define rep(i,n) for(i = 0;i < n;i++) #define F first #define S second using namespace std; typedef pair<int,int> P; class segtree{ P *a; //MAX_NUM,MAX_CNT int dep; //Length from root to leaf public: segtree(int depth,int x = 0){ int i; int size = (1 << (depth+1))-1; a = new P[size]; rep(i,size) a[i] = P(1,x); } ~segtree(){ delete[] a; } void add(int i,int x) { int index = (1 << dep)-1+i; int incnt = a[index].S + x; a[index] = P(index,incnt); while( index >= 0 ) { if( (a[index].S < incnt) || (a[index].S == incnt && a[index].F > i) ) a[index] = P( i,incnt ); index = (index-1) >> 1; } } P getmax(int i,int j) { if(i > j) swap(i,j); int index_l = (1 << dep)-1+i; int index_r = (1 << dep)-1+j; P ans; while( index_l < index_r ) { if( (a[index_l].S >= a[index_r].S) ) ans = a[index_l]; else ans = a[index_r]; index_l = ( (index_l-1) >> 1) +1; index_r = ( (index_r-1) >> 1) -1; } return ans; } } int main(){ segtree seg(20); int n,q,a,b; int i; cin >> n >> q; rep(i,q) { cin >> a >> b; seg.add( a,b ); cout << seg.getmax(1,n).F << " " << seg.getmax(1,n).S << endl; } return 0; }
a.cc:57:2: error: expected ';' after class definition 57 | } | ^ | ;
s827587488
p00099
C++
#include <iostream> #include <iomanip> #include <cassert> #include <algorithm> #include <functional> #include <vector> #include <string> #include <cstring> #include <stack> #include <queue> #include <map> #include <bitset> #include <sstream> #include <istream> #include <cmath> #include <cstdio> #include <complex> using namespace std; #define vci vector<int> #define vcs vector<string> #define pb push_back #define sz size() #define mapii map<int, int> #define mapci map<char, int> #define mapsi map<string, int> #define all(x) x.begin(), x.end() #define minit(a, i) memset(a, i, sizeof(a)); #define for_(i, a, b) for (int i=(int)a; i<(int)b; i++) #define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--) #define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c) #define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c) #define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i) template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; } typedef long long ll; typedef double D; const int iINF = 2147483647; const ll lINF = 9223372036854775807; template <class T> inline void dbg(T t) { cout << t << endl; } struct Part { int no, pos; Part (int no_, int pos_) : no(no_), pos(pos_) {} }; int MAX = 1000000; vector<Part> segpart; // winner : segpart[0] void init(int n) { segpart.assign(3*n, Part(MAX+1, 0)); for_(k, 0, n + 1 void init(int n) { segpart.assign(3*n, Part(MAX+1, 0)); for_(k, 0, n) { int k_ = k + n - 1; segprat[k_].no = k + 1; } }) { int k_ = k + n - 1; segpart[k_].no = k; } } Part maxpart(Part p1, Part p2) { if (p1.pos < p2.pos) return p2; else if (p1.pos > p2.pos) return p1; // p1.pos == p2.pos if (p1.no > p2.no) return p2; return p1; } void add(int n, int k, int v) { k += n-1; segpart[k].pos += v; while (k > 0) { k = (k-1)/2; segpart[k] = maxpart(segpart[k*2+1], segpart[k*2+2]); } } int main() { int n, q; cin >> n >> q; init(n); for_(i, 0, q) { int a, v; cin >> a >> v; add(n, a, v); cout << segpart[0].no << " " << segpart[0].pos << endl; } return 0; }
a.cc: In function 'void init(int)': a.cc:64:1: error: expected ';' before 'void' 64 | void init(int n) { | ^~~~ a.cc:31:49: note: in definition of macro 'for_' 31 | #define for_(i, a, b) for (int i=(int)a; i<(int)b; i++) | ^ a.cc:64:1: error: expected primary-expression before 'void' 64 | void init(int n) { | ^~~~ a.cc:31:49: note: in definition of macro 'for_' 31 | #define for_(i, a, b) for (int i=(int)a; i<(int)b; i++) | ^ a.cc:64:1: error: expected ')' before 'void' 64 | void init(int n) { | ^~~~ a.cc:31:49: note: in definition of macro 'for_' 31 | #define for_(i, a, b) for (int i=(int)a; i<(int)b; i++) | ^ a.cc:31:27: note: to match this '(' 31 | #define for_(i, a, b) for (int i=(int)a; i<(int)b; i++) | ^ a.cc:63:9: note: in expansion of macro 'for_' 63 | for_(k, 0, n + 1 | ^~~~ a.cc:64:18: error: a function-definition is not allowed here before '{' token 64 | void init(int n) { | ^ a.cc:31:49: note: in definition of macro 'for_' 31 | #define for_(i, a, b) for (int i=(int)a; i<(int)b; i++) | ^ a.cc:63:14: error: 'k' was not declared in this scope 63 | for_(k, 0, n + 1 | ^ a.cc:31:52: note: in definition of macro 'for_' 31 | #define for_(i, a, b) for (int i=(int)a; i<(int)b; i++) | ^
s641615357
p00099
C++
#include<algorithm> #include<cstring> #include<cmath> using namespace std; int main(){ int n,q; for(;cin>>n>>q;) { pair<int,int> tree[n*2-1]; for(int i=0;i<n*2-1;i++) tree[i]=make_pair(0,0); for(int i=0;i<q;i++) { int a,v; cin>>a>>v; a--; int num=a+(n-1); // cout<<num<<endl; tree[num].first+=v; tree[num].second=a+1; pair<int,int> base; while(true) { num=(num-1)/2; if(tree[num*2+1].first<tree[num*2+2].first|| (tree[num*2+1].first==tree[num*2+2].first &&tree[num*2+1].second>tree[num*2+2].second)) base=tree[num*2+2]; else base=tree[num*2+1]; tree[num]=base; if(num==0) break; } cout<<tree[0].second<<" "<<tree[0].first<<endl; // output(); } } }
a.cc: In function 'int main()': a.cc:9:8: error: 'cin' was not declared in this scope 9 | for(;cin>>n>>q;) | ^~~ a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 3 | #include<cmath> +++ |+#include <iostream> 4 | using namespace std; a.cc:35:11: error: 'cout' was not declared in this scope 35 | cout<<tree[0].second<<" "<<tree[0].first<<endl; | ^~~~ a.cc:35:11: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:35:53: error: 'endl' was not declared in this scope 35 | cout<<tree[0].second<<" "<<tree[0].first<<endl; | ^~~~ a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 3 | #include<cmath> +++ |+#include <ostream> 4 | using namespace std;
s948324807
p00100
Java
# Edit: 2014/09/25 # Lang: Python3 # Time: 0.xxs # if __name__ == "__main__": while True: d = {} n = int(input()) if not n: break # exit at n=0 for i in range(n): s, p, m = map(int, input().strip("\n").split(" ")) # s:社員番号, p:価格, m:販売戸数 # print(s, p, m) if s in d: d[s] = d[s] + p * m else: d[s] = p * m cnt = 0 for k, v in d.items(): if v >= 1000000: print(k) cnt +=1 if not cnt: print("NA") #print(d)
Main.java:1: error: illegal character: '#' # Edit: 2014/09/25 ^ Main.java:1: error: class, interface, enum, or record expected # Edit: 2014/09/25 ^ Main.java:2: error: illegal character: '#' # Lang: Python3 ^ Main.java:3: error: illegal character: '#' # Time: 0.xxs ^ Main.java:4: error: illegal character: '#' # ^ Main.java:12: error: illegal character: '#' break # exit at n=0 ^ Main.java:16: error: illegal character: '#' # s:????, p:??, m:???? ^ Main.java:17: error: illegal character: '#' # print(s, p, m) ^ Main.java:32: error: illegal character: '#' #print(d) ^ 9 errors
s823790967
p00100
Java
import java.util.*; public class Saleresult{ public static void main(String[] args){ ArrayList<String> view=new ArrayList<String>(); while(true){ Scanner sc =new Scanner(System.in); int datanum=sc.nextInt(); int[][] data=new int[datanum][4]; int encounter=0; if(datanum==0)break; for(int i=0;i<datanum;i++){ for(int j=0;j<3;j++){ data[i][j]=sc.nextInt(); } data[i][3]=data[i][1]*data[i][2]; for(int e=i-1;e>=0;e--){ if(data[i][0]==data[e][0]&&data[e][3]<1000000){ data[i][3]+=data[e][3]; encounter=1; } } if(data[i][3]>=1000000){ view.add(""+data[i][0]); encounter=1; } } if(encounter==0)view.add("NA"); } for(int i=0;i<view.size();i++)System.out.println(view.get(i)); } }
Main.java:2: error: class Saleresult is public, should be declared in a file named Saleresult.java public class Saleresult{ ^ 1 error
s477119815
p00100
Java
import java.util.*; public class Saleresult{ public static void main(String[] args){ ArrayList<String> view=new ArrayList<String>(); while(true){ Scanner sc =new Scanner(System.in); int datanum=sc.nextInt(); int[][] data=new int[datanum][4]; int encounter=0; if(datanum==0)break; for(int i=0;i<datanum;i++){ for(int j=0;j<3;j++){ data[i][j]=sc.nextInt(); } data[i][3]=data[i][1]*data[i][2]; for(int e=i-1;e>=0;e--){ if(data[i][0]==data[e][0]&&data[e][3]<1000000){ data[i][3]+=data[e][3]; encounter=1; } } if(data[i][3]>=1000000){ view.add(""+data[i][0]); encounter=1; } } if(encounter==0)view.add("NA"); } for(int i=0;i<view.size();i++)System.out.println(view.get(i)); } }
Main.java:2: error: class Saleresult is public, should be declared in a file named Saleresult.java public class Saleresult{ ^ 1 error
s237003636
p00100
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; public class Sale_Result { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ArrayList<String> SL = new ArrayList<String>(); while(true){ int num = Integer.parseInt(in.readLine()); if(num == 0){ break; } ArrayList<String> shain = new ArrayList<String>(); HashSet<String> over = new HashSet<String>(); HashMap<String,Integer> sale = new HashMap<String,Integer>(); for(int i = 0;i<num;i++){ String[] ss = in.readLine().split(" "); if(!over.contains(ss[0])){ if(!sale.containsKey(ss[0])){ sale.put(ss[0],0); shain.add(ss[0]); } int s = sale.get(ss[0])+Integer.parseInt(ss[1])*Integer.parseInt(ss[2]); sale.put(ss[0],s); if(s > 999999){ over.add(ss[0]); } } } ArrayList<String> SLs = new ArrayList<String>(); for(String s:shain){ if(over.contains(s)){ SLs.add(s); } } if(SLs.size() == 0){ SLs.add("NA"); } SL.addAll(SLs); } for(String s : SL){ System.out.println(s); } } }
Main.java:10: error: class Sale_Result is public, should be declared in a file named Sale_Result.java public class Sale_Result { ^ 1 error
s248728405
p00100
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; public class Sale_Result { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ArrayList<String> SL = new ArrayList<String>(); while(true){ int num = Integer.parseInt(in.readLine()); if(num == 0){ break; } HashSet<Integer> over = new HashSet<Integer>(); HashMap<Integer,Integer> sale = new HashMap<Integer,Integer>(); for(int i = 0;i<num;i++){ String[] ss = in.readLine().split(" "); int ss0 = Integer.parseInt(ss[0]); if(!over.contains(ss0)){ if(!sale.containsKey(ss0)){ sale.put(ss0,0); } long s = (long)sale.get(ss0)+Long.parseLong(ss[1])*Long.parseLong(ss[2]); if(s > 999999){ over.add(ss0); } else{ sale.put(ss0,(int)s); } } } ArrayList<Integer> SSS = new ArrayList<Integer>(over); Collections.sort(SSS); if(SSS.size() == 0){ SL.add("NA"); } else{ for(Integer i :SSS){ SL.add(i.toString()); } } } for(String s : SL){ System.out.println(s); } } }
Main.java:9: error: class Sale_Result is public, should be declared in a file named Sale_Result.java public class Sale_Result { ^ 1 error
s154615398
p00100
Java
{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); List<Integer> list = new ArrayList<Integer>(); while(true) { int n = sc.nextInt(); int count = 0; //一つも社員番号が出力されなかった場合に(T)が実行されます. if ( n == 0 ) break; for ( int i = 0; i < n; i++ ) { int dg = Integer.parseInt(sc.next()); int tanka = Integer.parseInt(sc.next()); int num = Integer.parseInt(sc.next()); int total = tanka * num; if ( total >= 1000000 ) { System.out.println(dg); count += 1; } } if ( count == 0 ) System.out.println("NA"); //(T) } } }
Main.java:1: error: class, interface, enum, or record expected { ^ Main.java:2: error: unnamed classes are a preview feature and are disabled by default. public static void main(String[] args) ^ (use --enable-preview to enable unnamed classes) Main.java:38: error: class, interface, enum, or record expected } ^ 3 errors