submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s315498223 | p00451 | C++ | #include<iostream>
#include<cstring>
#include<string>
using namespace std;
int main(void){
int a,b;
while(1){
memset(len,0,sizeof(len));
string str;
string str2;
int ans=0;
cin >> str;
if(str=="EOF")break;
cin >> str2;
for(a=0;a<str.size();a++){
int res=0;
string tmp= str.substr(a, str.length()-a);
for(b=0;b<min(tmp.size(),str2.size());b++){
if(tmp[b]==str2[b])res++;
else ans=max(res,ans),res=0;
if(min(tmp.size(),str2.size())-1==b)ans=max(res,ans);
}
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:24: error: 'len' was not declared in this scope; did you mean 'mblen'?
10 | memset(len,0,sizeof(len));
| ^~~
| mblen
|
s405723815 | p00451 | C++ | #include<iostream>
#include<cstring>
#include<string>
using namespace std;
int main(void){
int a,b;
while(1){
memset(len,0,sizeof(len));
string str;
string str2;
int ans=0;
cin >> str;
if(str=="EOF")break;
cin >> str2;
for(a=0;a<str.size();a++){
int res=0;
string tmp= str.substr(a, str.size()-a);
for(b=0;b<min(tmp.size(),str2.size());b++){
if(tmp[b]==str2[b])res++;
else ans=max(res,ans),res=0;
if(min(tmp.size(),str2.size())-1==b)ans=max(res,ans);
}
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:24: error: 'len' was not declared in this scope; did you mean 'mblen'?
10 | memset(len,0,sizeof(len));
| ^~~
| mblen
|
s260633112 | p00451 | C++ | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<math.h>
int main(void){
char s[4001],t[4001];
while(scanf("%s",s)!=EOF){
scanf("%s",t);
int sl = strlen(s),tl = strlen(t);
int ans = 0;
for(int i=0;i+ans<sl;i++){
for(int j=0;j+ans<tl;j++){
if(s[i]==t[j]){
for(int k=1;j+k<tl && i+k<sl;k++){
ans = max(ans,k);
if(s[i+k]!=t[j+k])break;
}
}
}
}
printf("%d\n",ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:16:55: error: 'max' was not declared in this scope; did you mean 'std::max'?
16 | ans = max(ans,k);
| ^~~
| std::max
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
|
s214826724 | p00451 | C++ | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<math>
int main(void){
char s[4001],t[4001];
while(scanf("%s",s)!=EOF){
scanf("%s",t);
int sl = strlen(s),tl = strlen(t);
int ans = 0;
for(int i=0;i+ans<sl;i++){
for(int j=0;j+ans<tl;j++){
if(s[i]==t[j]){
for(int k=1;j+k<tl && i+k<sl;k++){
ans = max(ans,k);
if(s[i+k]!=t[j+k])break;
}
}
}
}
printf("%d\n",ans);
}
return 0;
} | a.cc:5:9: fatal error: math: No such file or directory
5 | #include<math>
| ^~~~~~
compilation terminated.
|
s725010433 | p00451 | C++ | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int dp[4001][4001]={};
char str1[4005],str2[4005];
int ans=0;
int main(){while(
scanf("%s%s",str1,str2)!=-1){
for(int i=0;i<strlen(str1);i++){
for(int j=0;j<strlen(str2);j++){
if(str1[i]==str2[j]){
if(i==0 || j==0){ dp[i][j]=1;ans=max(ans,1);}
else{ dp[i][j]=1+dp[i-1][j-1];ans=max(ans,dp[i][j])}
}}}printf("%d\n",ans); }return 0;}
| a.cc: In function 'int main()':
a.cc:14:61: error: expected ';' before '}' token
14 | else{ dp[i][j]=1+dp[i-1][j-1];ans=max(ans,dp[i][j])}
| ^
| ;
|
s722716360 | p00451 | C++ | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
short dp[4001][4001]={};
char str1[4005],str2[4005];
int ans=0;
int main(){while(scanf("%s%s",str1,str2)!=-1){
for(int i=0;i<strlen(str1);i++){
for(int j=0;j<strlen(str2);j++){
if(str1[i]==str2[j]){
if(i==0 || j==0){ dp[i][j]=1;ans=max(ans,1);}
else{ dp[i][j]=1+dp[i-1][j-1];ans=max(ans,dp[i][j]);}
}}}printf("%d\n",ans); }return 0;}
| a.cc: In function 'int main()':
a.cc:13:47: error: no matching function for call to 'max(int&, short int&)'
13 | else{ dp[i][j]=1+dp[i-1][j-1];ans=max(ans,dp[i][j]);}
| ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from a.cc:3:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:13:47: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
13 | else{ dp[i][j]=1+dp[i-1][j-1];ans=max(ans,dp[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:
/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:13:47: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
13 | else{ dp[i][j]=1+dp[i-1][j-1];ans=max(ans,dp[i][j]);}
| ~~~^~~~~~~~~~~~~~
|
s150515518 | p00451 | C++ | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int dp[4001][4001]={};
char str1[4005],str2[4005];
short ans=0;
int main(){while(scanf("%s%s",str1,str2)!=-1){
for(int i=0;i<strlen(str1);i++){
for(int j=0;j<strlen(str2);j++){
if(str1[i]==str2[j]){
if(i==0 || j==0){ dp[i][j]=1;ans=max(ans,1);}
else{ dp[i][j]=1+dp[i-1][j-1];ans=max(ans,dp[i][j]);}
}}}printf("%d\n",ans); }return 0;}
| a.cc: In function 'int main()':
a.cc:12:46: error: no matching function for call to 'max(short int&, int)'
12 | if(i==0 || j==0){ dp[i][j]=1;ans=max(ans,1);}
| ~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from a.cc:3:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:12:46: note: deduced conflicting types for parameter 'const _Tp' ('short int' and 'int')
12 | if(i==0 || j==0){ dp[i][j]=1;ans=max(ans,1);}
| ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:12:46: note: mismatched types 'std::initializer_list<_Tp>' and 'short int'
12 | if(i==0 || j==0){ dp[i][j]=1;ans=max(ans,1);}
| ~~~^~~~~~~
a.cc:13:47: error: no matching function for call to 'max(short int&, int&)'
13 | else{ dp[i][j]=1+dp[i-1][j-1];ans=max(ans,dp[i][j]);}
| ~~~^~~~~~~~~~~~~~
/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:13:47: note: deduced conflicting types for parameter 'const _Tp' ('short int' and 'int')
13 | else{ dp[i][j]=1+dp[i-1][j-1];ans=max(ans,dp[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
/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:13:47: note: mismatched types 'std::initializer_list<_Tp>' and 'short int'
13 | else{ dp[i][j]=1+dp[i-1][j-1];ans=max(ans,dp[i][j]);}
| ~~~^~~~~~~~~~~~~~
|
s065081512 | p00451 | C++ | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
short dp[4001][4001]={};
char str1[4005],str2[4005];
short ans=0;
int main(){
while(scanf("%s",str1)!=EOF){
scanf("%s",str2);
}
printf("%d\n",ans); }return 0;}
| a.cc:12:24: error: expected unqualified-id before 'return'
12 | printf("%d\n",ans); }return 0;}
| ^~~~~~
a.cc:12:33: error: expected declaration before '}' token
12 | printf("%d\n",ans); }return 0;}
| ^
|
s227797638 | p00451 | C++ | #include<stdio.h>#include <string.h>
short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;} | a.cc:1:18: warning: extra tokens at end of #include directive
1 | #include<stdio.h>#include <string.h>
| ^
a.cc: In function 'int main()':
a.cc:2:118: error: 'strlen' was not declared in this scope
2 | short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;}
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<stdio.h>#include <string.h>
+++ |+#include <cstring>
2 | short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;}
a.cc:2:188: error: 'b' was not declared in this scope
2 | short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;}
| ^
a.cc:2:352: error: 'memset' was not declared in this scope
2 | short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;}
| ^~~~~~
a.cc:2:352: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s333627187 | p00451 | C++ | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
char[] s1 = sc.next().toCharArray();
char[] s2 = sc.next().toCharArray();
int len1 = s1.length;
int len2 = s2.length;
//intテ・ツ楪凝」ツ?ァ, 4000*4000テ」ツつ津ァツ「ツコテ、ツソツ敕」ツ?凖」ツつ?-> MLE
//shortテ・ツ楪凝」ツ?繰avaテ」ツ?ァテ、ツスツ陛」ツδ静」ツつ、テ」ツδ暗」ツ?凝、ツクツ催ヲツ伉偲」ツ??」ツ?古ィツゥツヲテ」ツ??-> MLE
//テ、ツサツ陛ヲツ鳴ケテ」ツ?古」ツ?ェテ」ツ??」ツ?ョテ」ツ?ァテ」ツ??ゥツ?催・ツ按療ッツシツ妥ィツ。ツ古」ツつ津、ツスツソテ」ツ??・ツ崢榲」ツ?凖・ツスツ「テ」ツ?ォ
short[][] dp = new short[2][len2 + 1];
short maxLen = 0;
for(int idx1 = 0; idx1 < len1; idx1++){
int i = idx1 % 2;
int ni = (i + 1) % 2;
Arrays.fill(dp[ni], (short)0);
for(int idx2 = 0; idx2 < len2; idx2++){
if(s1[idx1] == s2[idx2]){
dp[ni][idx2 + 1] = (short)(dp[i][idx2] + 1);
maxLen = (short)Math.max(maxLen, dp[ni][idx2 + 1]);
}
}
}
System.out.println(maxLen);
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main{
| ^~~~~~
|
s546541010 | p00451 | C++ | #include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
template<class T> inline void chmax(T& a, T b) { if(b > a) a = b; }
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
for(string a, b; cin >> a;) {
cin >> b;
vector<vector<int> > dp(a.size() + 1, vector<int>(b.size() + 1, 0));
for(int i = 0; i < a.size(); ++i)
for(int j = 0; j < b.size(); ++j)
if(a[i] == b[j])
chmax(dp[i + 1][j + 1], dp[i][j] + 1);
int ans = 0;
for(int i = 0; i < dp.size(); ++i)
chmax(ans, *max_element(dp[i].begin(), dp[i].end()));
cout << ans << endl;
}
return EXIT_SUCCESS;
} | a.cc: In function 'int main()':
a.cc:24:37: error: 'max_element' was not declared in this scope
24 | chmax(ans, *max_element(dp[i].begin(), dp[i].end()));
| ^~~~~~~~~~~
|
s757303890 | p00451 | C++ | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <cstring>
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair
#define X first
#define Y second
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> P;
const int INF = 1<<29;
int common(string &a, string &b){
int size = min(a.size(), b.size());
int res = 0, cnt = 0;
rep(i, size){
if(a[i]==b[i]) cnt++;
else{
res = max(res, cnt);
cnt = 0;
}
}
return max(res, cnt);
}
int check(string &a, string &b){
int res = 0;
rep(i, a.size()){
res = max(res, common(a.substr(i),b));
}
return res;
}
int main(){
string a, b;
while(cin >> a >> b){
cout << max(check(a, b), check(b, a)) << endl;
}
return 0;
} | a.cc: In function 'int check(std::string&, std::string&)':
a.cc:39:47: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
39 | res = max(res, common(a.substr(i),b));
| ~~~~~~~~^~~
a.cc:23:20: note: initializing argument 1 of 'int common(std::string&, std::string&)'
23 | int common(string &a, string &b){
| ~~~~~~~~^
|
s036384597 | p00451 | C++ | #include <iostream>
#include <string>
#include <cstring>
short dp[4001][4001];
using namespace std;
int main(){
string s,str;
int ans = 0;
while(cin >> s >> str){
memset(dp,0,sizeof(dp));
for(int i=0,l=s.size();i<l;i++){
for(int j=0,ll=str.size();j<ll;j++){
if(s[i] == str[j]){
dp[i+1][j+1] = dp[i][j]+1;
ans = max(ans,dp[i+1][j+1]);
}else dp[i+1][j+1] = 0;
}
}
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:15:20: error: no matching function for call to 'max(int&, short int&)'
15 | ans = max(ans,dp[i+1][j+1]);
| ~~~^~~~~~~~~~~~~~~~~~
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:15:20: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
15 | ans = max(ans,dp[i+1][j+1]);
| ~~~^~~~~~~~~~~~~~~~~~
/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
|
s989525778 | p00451 | C++ | #include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <iterator>
#include <queue>
#include <stack>
#include <deque>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <string>
#include <cmath>
#include <complex>
#include <functional>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cstdlib>
#include <cctype>
#define REP(i,m,n) for(int i=m;i<(int)n;i++)
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rrep(i,n) for(int i = 1; i <= n; i++)
#define drep(i,n) for(int i = n; i >= 0; i--)
#define rp(i,c) rep(i,(int)c.size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(u) (u).rbegin(),(u).rend()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl
#define v_delete(a,b) (a).erase(remove((a).begin(), (a).end(), b), (a).end())
#define v_unique(a) (a).erase(unique((a).begin(), (a).end()), (a).end())
#define VV(T) vector<vector< T > >
#define init(a,b) memset((a), (b), sizeof((a)))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int inf=1<<28;
const double INF=1e10,EPS=1e-9;
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
template <class T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
template <class T> void input(T* a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
int dp[4002][4002]={0};
int main(){
string a,b;
while(cin >> a,a!=EOF){
int as=a.size();
a+='a';
int bs=b.size();
b+='b';
int ans=0;
for(int i=0;i<as;i++){
for(int j=0;j<bs;j++){
if(a[i+1]==b[j+1]){
dp[i+1][j+1]=dp[i][j]+1;
}else{
dp[i+1][j+1]=0;
}/*
if(dp[i+1][j+1]){
cout << dp[i+1][j+1]<<endl;
cout << i << "," << j << endl;
}*/
ans=max(ans,dp[i+1][j+1]);
}
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:62:25: error: no match for 'operator!=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
62 | while(cin >> a,a!=EOF){
| ~^~
| |
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)'
197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/14/cstdio:42,
from /usr/include/c++/14/ext/string_conversions.h:45,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
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:
a.cc:62:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
62 | while(cin >> a,a!=EOF){
| ^~~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)'
243 | operator!=(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed:
a.cc:62:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
62 | while(cin >> a,a!=EOF){
| ^~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
455 | operator!=(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed:
a.cc:62:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
62 | while(cin >> a,a!=EOF){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
500 | operator!=(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed:
a.cc:62:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
62 | while(cin >> a,a!=EOF){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1686 | operator!=(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed:
a.cc:62:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
62 | while(cin >> a,a!=EOF){
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1753 | operator!=(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed:
a.cc:62:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
62 | while(cin >> a,a!=EOF){
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed:
a.cc:62:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
62 | while(cin >> a,a!=EOF){
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47:
/usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
651 | operator!=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed:
a.cc:62:27: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
62 | while(cin >> a,a!=EOF){
| ^~~
/usr/include/c++/14/string_view:658:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
658 | operator!=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed:
a.cc:62:27: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
62 | while(cin >> a,a!=EOF){
| ^~~
/usr/include/c++/14/string_view:666:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed:
a.cc:62:27: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
62 | while(cin >> a,a!=EOF){
| ^~~
/usr/include/c++/14/bits/basic_string.h:3833:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3833:5: note: template argument deduction/substitution failed:
a.cc:62:27: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
62 | while(cin >> a,a!=EOF){
| ^~~
/usr/include/c++/14/bits/basic_string.h:3847:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3847 | operator!=(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3847:5: note: template argument deduction/substitution failed:
a.cc:62:27: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
62 | while(cin >> a,a!=EOF){
| ^~~
/usr/include/c++/14/bits/basic_string.h:3860:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3860 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3860:5: note: template argument deduction/substitution failed:
a.cc:62:27: note: mismatched types 'const _CharT*' and 'int'
62 | while(cin >> a,a!=EOF){
| ^~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2613 | operator!=(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed:
a.cc:62:27: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>'
62 | while(cin >> a,a!=EOF){
| ^~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46:
/usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator!=(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)'
242 | operator!=(const istreambuf_iterator<_CharT, _Traits>& __a,
| ^~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: template argument deduction/substitution failed:
a.cc:62:27: note: 'std::string |
s738195137 | p00452 | Java | import java.util.Arrays;
import java.util.Scanner;
public class Main1{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true) {
int n = sc.nextInt();
int m = sc.nextInt();
if(n == 0 && m == 0)break;
int[] p = new int[n];
for(int i=0;i<n;i++) {
p[i] = sc.nextInt();
}
int[] q = new int[((n+2)*(n+1))/2]; //!!!!
int r = 0;
for(int i = 0;i<=n;i++) {
for(int j=i;j<=n;j++) {
q[r++] = p[i]+p[j];
}
}
Arrays.sort(q);
long s = 0;
for(int i=0;i<q.length;i++) {
if(m-q[i] < 0)continue;
if(r >= 0)s = Math.max(s,q[i]+q[r]);
}
System.out.println(s);
}
}
}
| Main.java:4: error: class Main1 is public, should be declared in a file named Main1.java
public class Main1{
^
1 error
|
s956226222 | p00452 | C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
long p2[501501],c,all;
void add(long);
void put(long num,long place);
long search(long,long,long,long);
int cmp(const void*,const void*);
int main(){
long p[1001],m,j,max,num,call,;
int n,i;
while(1){
scanf("%d %ld",&n,&m);
if(n==0) break;
p2[0]=0;
all=1;
p[0]=0;
for(i=1;i<=n;i++){
scanf("%ld",&cp);
p[i]=cp;
qsort(p,i+1,sizeof(long),cmp);
c=0;
call=all;
for(j=0;j<i;j++){
if(p[j]+cp>m) break;
add(p[j]+cp);
}
}
max=0;
for(j=1;j<all;j++){
num=search(p2[j],m,0,all-1);
max=(num>max)?num:max;
}
printf("%ld\n",max);
}
return 0;
}
void add(long p){
for(;c<all;c++){
if(p2[c]>p){
put(p,c);
all++;
return;
}else if(p2[c]==p){
return;
}
}
put(p,all);
all++;
}
void put(long num,long place){
long i;
for(i=all;i>place;i--){
p2[i]=p2[i-1];
}
p2[place]=num;
for(i=0;i<=all;i++){
}
}
long search(long num,long max,long start,long end){
if(start==end) return num+p2[start];
if(p2[(end-start+1)/2+start]>max-num){
return search(num,max,start,(end-start+1)/2+start-1);
}else{
return search(num,max,(end-start+1)/2+start,end);
}
}
int cmp(const void* a,const void* b){
return *(long*)a-*(long*)b;
} | main.c: In function 'main':
main.c:10:39: error: expected identifier or '(' before ';' token
10 | long p[1001],m,j,max,num,call,;
| ^
main.c:19:38: error: 'cp' undeclared (first use in this function); did you mean 'p'?
19 | scanf("%ld",&cp);
| ^~
| p
main.c:19:38: note: each undeclared identifier is reported only once for each function it appears in
|
s685555624 | p00452 | C | #include<stdio.h>
#include<stdlib.h>
long sum[1002001];
long sumnum;
int cmp(const void *a, const void *b);
long search(long,long,long,long);
int main(){
int n,i,j;
long m,p[1000],k,max,score;
while(1){
scanf("%d %ld",&n,&m);
if(n==0) break;
sum[0]=0;
sumnum=1;
for(i=0;i<n;i++){
scanf("%ld",&p[i]);
sum[sumnum]=p[i];
sumnum++;
for(j=0;j<=i;j++){
if(p[i]+p[j]>m) continue;
sum[sumnum]=p[i]+p[j];
sumnum++;
}
}
qsort(sum,sumnum,sizeof(long),cmp);
max=0;
for(k=0;k<sumnum/2+1;k++){
score=search(sum[k],m,0,sumnum-1);
max=(score>max)?score:max;
}
printf("%ld\n",max);
}
return 0;
}
long search(long num,long max,long s,long e){
if(s==e) return num+sum[e];
if(max-num>sum[(e-s)/2+s+1]){
return search(num,max,(e-s)/2+s+1,e);
}
return search(num,max,s,(e-s)/2+s);
}
long search(long num,long max,long s,long e){
if(s==e) return num+sum[e];
if(max-num>sum[(e-s)/2+s+1]){
return search(num,max,(e-s)/2+s+1,e);
}
return search(num,max,s,(e-s)/2+s);
}
int cmp(const void *a, const void* b){
return *(long *)a-*(long*)b;
} | main.c:48:6: error: redefinition of 'search'
48 | long search(long num,long max,long s,long e){
| ^~~~~~
main.c:40:6: note: previous definition of 'search' with type 'long int(long int, long int, long int, long int)'
40 | long search(long num,long max,long s,long e){
| ^~~~~~
|
s268728109 | p00452 | C | #include<stdio.h>
#include<stdlib.h>
long sum[1002001];
long sumnum;
int cmp(const void *a, const void *b);
long search(long,long,long,long);
int main(){
int n,i,j;
long m,p[1000],k,max,score;
while(1){
scanf("%d %ld",&n,&m);
if(n==0) break;
sum[0]=0;
sumnum=1;
for(i=0;i<n;i++){
scanf("%ld",&p[i]);
sum[sumnum]=p[i];
sumnum++;
for(j=0;j<=i;j++){
if(p[i]+p[j]>m) continue;
sum[sumnum]=p[i]+p[j];
sumnum++;
}
}
qsort(sum,sumnum,sizeof(long),cmp);
max=0;
for(k=0;k<sumnum/2+1;k++){
score=search(sum[k],m,0,sumnum-1);
max=(score>max)?score:max;
}
printf("%ld\n",max);
}
return 0;
}
long search(long num,long max,long s,long e){
if(s==e) return num+sum[e];
if(max-num>sum[(e-s)/2+s+1]){
return search(num,max,(e-s)/2+s+1,e);
}
return search(num,max,s,(e-s)/2+s);
}
long search(long num,long max,long s,long e){
if(s==e) return num+sum[e];
if(max-num>sum[(e-s)/2+s+1]){
return search(num,max,(e-s)/2+s+1,e);
}
return search(num,max,s,(e-s)/2+s);
}
int cmp(const void *a, const void* b){
return *(long *)a-*(long*)b;
} | main.c:48:6: error: redefinition of 'search'
48 | long search(long num,long max,long s,long e){
| ^~~~~~
main.c:40:6: note: previous definition of 'search' with type 'long int(long int, long int, long int, long int)'
40 | long search(long num,long max,long s,long e){
| ^~~~~~
|
s052971687 | p00452 | C | #include "stdafx.h"
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int ans[4];
int temp;
double energy,energy_min,energy_now;
int M, N;
int* p;
int i, j;
double T=100;
int ret;
while (1) {
scanf_s("%d%d", &N, &M);
p = (int*)malloc((N+1) * sizeof(int));
for (i = 0; i < N; i++) {
scanf_s("%d", &p[i]);
}
p[N] = 0;
if (N == M && N == 0) {
break;
}
energy_min = pow(10, 300);
for (j = 0; j < 4; j++) {
ans[j] = p[(int)((double)(rand() + 1) / (RAND_MAX + 2)*(N+1))];
}
for (T = 100000; T > 100; T--) {
for (j = 0; j < 4; j++) {
temp = p[(int)((double)(rand() + 1) / (RAND_MAX + 2)*(N+1))];
for (j = 0; j < 4; j++) {
ret = ans[0] + ans[1] + ans[2] + ans[3];
ret += temp - ans[j];
energy = M - ret;
if (M < ret)energy += 100000000;
if (energy < energy_min) {
energy_min = energy;
ans[j] = temp;
}
else if ((double)(rand() + 1) / (RAND_MAX + 2) < exp((energy_min - energy) / T*1000)) {
energy_min = energy;
ans[j] = temp;
}
}
}
}
ret=ans[0]+ +ans[1] + ans[2] + ans[3];
printf("%d\n", ret);
}
return 0;
} | main.c:1:10: fatal error: stdafx.h: No such file or directory
1 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s924362233 | p00452 | C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define mem(x,y) (x*)malloc(sizeof(x)*(y))
int int_sort(const void* a,const void* b)
{
if(*(int *)a < *(int *)b)
{
return -1;
}
else if(*(int *)a == *(int *)b)
{
return 0;
}
return 1;
}
int* search(int point,int* list,int len,int max)
{
double i = len/2.0;
double size = len/2.0;
int maxp = 0;
int* data = mem(int,2);
while(1)
{
const int pt = point+list[(int)i];
if(pt > max)
{
if(size < 0.5)
{
break;
}
else
{
size/=2.0;
i-=size;
}
}
else
{
if(maxp < pt)
maxp = pt;
if(size < 0.5)
{
break;
}
else
{
size/=2.0;
i+=size;
}
}
}
data[0] = maxp;
data[1] = (int)i;
return data;
}
int main()
{
int n,m;
int* data;
int* list;
int i,j,k;
while(scanf("%d %d",&n,&m),n,m)
{
int list_len = (n+1)*(n+1);
data = mem(int,n+1);
list = mem(int,list_len);
data[0] = 0;
for(i = 1;i <= n;i++)
{
scanf("%d",&data[i]);
}
for(k = i = 0;i <= n;i++)
{
for(j = 0;j <= i;j++,k++)
{
list[k] = data[i]+data[j];
}
}
list_len = k+1;
qsort(list,list_len,sizeof(int),int_sort);
int max = 0;
for(i = 0;i<ll_tmp;i++)
{
int* val = search(list[i],list,list_len,m);
if(val[0] > max)
{
max = val[0];
}
list_len = val[1]+1;
}
printf("%d\n",max);
}
return 0;
} | main.c: In function 'main':
main.c:86:29: error: 'll_tmp' undeclared (first use in this function)
86 | for(i = 0;i<ll_tmp;i++)
| ^~~~~~
main.c:86:29: note: each undeclared identifier is reported only once for each function it appears in
|
s208126829 | p00452 | C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define mem(x,y) (x*)malloc(sizeof(x)*(y))
int int_sort(const void* a,const void* b)
{
if(*(int *)a < *(int *)b)
{
return -1;
}
else if(*(int *)a == *(int *)b)
{
return 0;
}
return 1;
}
int* search(int point,int* list,int len,int max)
{
double i = len/2.0;
double size = len/2.0;
int maxp = 0;
int* data = mem(int,2);
while(1)
{
const int pt = point+list[(int)i];
if(pt > max)
{
if(size < 0.5)
{
break;
}
else
{
size/=2.0;
i-=size;
}
}
else
{
if(maxp < pt)
maxp = pt;
if(size < 0.5)
{
break;
}
else
{
size/=2.0;
i+=size;
}
}
}
data[0] = maxp;
data[1] = (int)i;
return data;
}
int main()
{
int n,m;
int* data;
int* list;
int i,j,k;
while(scanf("%d %d",&n,&m),n,m)
{
int list_len = (n+1)*(n+1);
data = mem(int,n+1);
list = mem(int,list_len);
data[0] = 0;
for(i = 1;i <= n;i++)
{
scanf("%d",&data[i]);
}
for(k = i = 0;i <= n;i++)
{
for(j = 0;j <= i;j++,k++)
{
list[k] = data[i]+data[j];
}
}
list_len = k+1;
qsort(list,list_len,sizeof(int),int_sort);
int max = 0;
for(i = 0;i<ll_tmp;i++)
{
int* val = search(list[i],list,list_len,m);
if(val[0] > max)
{
max = val[0];
}
list_len = val[1]+1;
}
printf("%d\n",max);
}
return 0;
} | main.c: In function 'main':
main.c:86:29: error: 'll_tmp' undeclared (first use in this function)
86 | for(i = 0;i<ll_tmp;i++)
| ^~~~~~
main.c:86:29: note: each undeclared identifier is reported only once for each function it appears in
|
s354451831 | p00452 | C | import std.array;
import std.range;
import std.stdio;
import std.conv;
import std.string;
import std.algorithm;
void main()
{
while(true) {
string[] input = split(chomp(readln()));
int N = to!int(input[0]);
int M = to!int(input[1]);
if(N==0&&M==0) break;
int[] inp = new int[N+1];
inp[0] = 0;
for(int i=0; i<N; i++) {
input = split(chomp(readln()));
inp[i+1] = to!int(input[0]);
}
N++;
int[] add2 = new int[N * N];
for(int i=0; i<N; i++)
for(int j=0; j<N; j++)
add2[j*N + i] = inp[i] + inp[j];
auto sorted = array(uniq(sort(add2)));
auto r = assumeSorted(sorted);
int res;
foreach(v; sorted)
{
if(v > M) break;
res = max(res, v + r.lowerBound(M-v).back);
}
writeln(res);
}
} | main.c:1:1: error: unknown type name 'import'
1 | import std.array;
| ^~~~~~
main.c:1:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
1 | import std.array;
| ^
main.c:2:1: error: unknown type name 'import'
2 | import std.range;
| ^~~~~~
main.c:2:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
2 | import std.range;
| ^
main.c:3:1: error: unknown type name 'import'
3 | import std.stdio;
| ^~~~~~
main.c:3:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
3 | import std.stdio;
| ^
main.c:4:1: error: unknown type name 'import'
4 | import std.conv;
| ^~~~~~
main.c:4:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
4 | import std.conv;
| ^
main.c:5:1: error: unknown type name 'import'
5 | import std.string;
| ^~~~~~
main.c:5:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
5 | import std.string;
| ^
main.c:6:1: error: unknown type name 'import'
6 | import std.algorithm;
| ^~~~~~
main.c:6:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
6 | import std.algorithm;
| ^
main.c: In function 'main':
main.c:10:15: error: 'true' undeclared (first use in this function)
10 | while(true) {
| ^~~~
main.c:1:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
+++ |+#include <stdbool.h>
1 | import std.array;
main.c:10:15: note: each undeclared identifier is reported only once for each function it appears in
10 | while(true) {
| ^~~~
main.c:11:17: error: 'string' undeclared (first use in this function)
11 | string[] input = split(chomp(readln()));
| ^~~~~~
main.c:11:24: error: expected expression before ']' token
11 | string[] input = split(chomp(readln()));
| ^
main.c:12:25: error: 'to' undeclared (first use in this function)
12 | int N = to!int(input[0]);
| ^~
main.c:12:27: error: expected ',' or ';' before '!' token
12 | int N = to!int(input[0]);
| ^
main.c:13:27: error: expected ',' or ';' before '!' token
13 | int M = to!int(input[1]);
| ^
main.c:17:20: error: expected identifier or '(' before '[' token
17 | int[] inp = new int[N+1];
| ^
main.c:18:17: error: 'inp' undeclared (first use in this function); did you mean 'int'?
18 | inp[0] = 0;
| ^~~
| int
main.c:21:25: error: 'input' undeclared (first use in this function); did you mean 'int'?
21 | input = split(chomp(readln()));
| ^~~~~
| int
main.c:21:33: error: implicit declaration of function 'split' [-Wimplicit-function-declaration]
21 | input = split(chomp(readln()));
| ^~~~~
main.c:21:39: error: implicit declaration of function 'chomp' [-Wimplicit-function-declaration]
21 | input = split(chomp(readln()));
| ^~~~~
main.c:21:45: error: implicit declaration of function 'readln' [-Wimplicit-function-declaration]
21 | input = split(chomp(readln()));
| ^~~~~~
main.c:22:38: error: expected ';' before '!' token
22 | inp[i+1] = to!int(input[0]);
| ^
| ;
main.c:27:20: error: expected identifier or '(' before '[' token
27 | int[] add2 = new int[N * N];
| ^
main.c:31:25: error: 'add2' undeclared (first use in this function)
31 | add2[j*N + i] = inp[i] + inp[j];
| ^~~~
main.c:33:22: error: type defaults to 'int' in declaration of 'sorted' [-Wimplicit-int]
33 | auto sorted = array(uniq(sort(add2)));
| ^~~~~~
main.c:33:31: error: implicit declaration of function 'array' [-Wimplicit-function-declaration]
33 | auto sorted = array(uniq(sort(add2)));
| ^~~~~
main.c:33:37: error: implicit declaration of function 'uniq'; did you mean 'unix'? [-Wimplicit-function-declaration]
33 | auto sorted = array(uniq(sort(add2)));
| ^~~~
| unix
main.c:33:42: error: implicit declaration of function 'sort' [-Wimplicit-function-declaration]
33 | auto sorted = array(uniq(sort(add2)));
| ^~~~
main.c:34:22: error: type defaults to 'int' in declaration of 'r' [-Wimplicit-int]
34 | auto r = assumeSorted(sorted);
| ^
main.c:34:26: error: implicit declaration of function 'assumeSorted' [-Wimplicit-function-declaration]
34 | auto r = assumeSorted(sorted);
| ^~~~~~~~~~~~
main.c:37:17: error: implicit declaration of function 'foreach' [-Wimplicit-function-declaration]
37 | foreach(v; sorted)
| ^~~~~~~
main.c:37:25: error: 'v' undeclared (first use in this function)
37 | foreach(v; sorted)
| ^
main.c:37:26: error: expected ')' before ';' token
37 | foreach(v; sorted)
| ~ ^
| )
main.c:37:35: error: expected ';' before '{' token
37 | foreach(v; sorted)
| ^
| ;
38 | {
| ~
|
s743098286 | p00452 | C | #include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main( void )
{
int n, m, input[1001];
while(cin >> n >> m, n | m) {
for(int i=0; i < n; ++i) cin >> input[i];
sort(input, input+n, greater<int>());
//for(int i=0; i < n; ++i) cout << input[i] << ' ';
//cout << endl;
input[n++] = 0;
int Max = 0;
for(int i=0; i < n; ++i)
for(int j=i; j < n; ++j)
for(int k=j; k < n; ++k)
for(int l=k; l < n; ++l) {
int sum = input[i] + input[j] + input[k] + input[l];
if(sum <= m && Max < sum) Max = sum;
}
cout << Max << endl;
}
return 0;
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s414082147 | p00452 | C | #include<cstdio>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int N,M,R,P[1005]={0},X[1000005];
int bs(int r,int l,int k)
{
int m;
while(l-r>1)
{
m=(r+l)/2;
if(X[m]==k)
return m;
if(X[m]<=k)
r=m+1;
else
l=m-1;
}
return l;
}
int main()
{
for(;scanf("%d%d",&N,&M),N;)
{
for(int i=0,t;i<N;i++)
scanf("%d",&P[i+1]);
int p=0;
for(int i=0;i<=N;i++)
for(int j=i;j<=N;j++)
X[p++]=P[i]+P[j];
sort(X,X+p);
for(int i=R=0;i<p;i++)
{
if(X[i]<=M)
{
int t=X[i]+X[bs(0,p-1,M-X[i])];
R=max(R,t>M?0:t);
}
}
printf("%d\n",R);
}
return 0;
} | main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s304405784 | p00452 | C++ | import java.util.Arrays;
import java.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
while(true){
int n = sc.nextInt();
int m = sc.nextInt();
if(n == 0 && m == 0){
break;
}
int[] input = new int[n];
for(int i = 0; i < n ; i++){
input[i] = sc.nextInt();
}
System.out.println(solve(input, m));
}
}
//半分全列挙で解きたい
static long solve(int[] array, int limit){
int n = array.length + 1;
int[] copyArray = new int[n];
//0を追加した配列を作る
for(int i = 0 ; i < n - 1; i++){
copyArray[i] = array[i];
}
//2回投げたときに有り得る得点
long[] twoTimes = new long[n*n];
int index = 0;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
twoTimes[index++] = copyArray[i] + copyArray[j];
}
}
Arrays.sort(twoTimes);
//debug
// for(int i = 0; i < twoTimes.length; i++){
// System.out.println(twoTimes[i]);
// }
long result = 0;
for(int i = 0; i < twoTimes.length ; i++){
//そもそも2回だけで済む場合
if(twoTimes[i] == limit){
System.out.println("JUST");
return twoTimes[i];
}
//既にオーバーしている場合も論外
else if (twoTimes[i] > limit){
// System.out.println("OVER i = "+i+" "+twoTimes[i]);
break;
}
//わざと少し下を狙う
int tmpIndex = Arrays.binarySearch(twoTimes, limit - twoTimes[i] - 1);
if(tmpIndex < 0){
tmpIndex++;
tmpIndex *= -1;
tmpIndex--;
}
if(tmpIndex >= twoTimes.length){
tmpIndex = twoTimes.length - 1;
}
for(int j = Math.max(tmpIndex, 0); j < twoTimes.length; j++){
// if(twoTimes[i] + twoTimes[j] > limit){
// break;
// }
// System.out.println("j = "+j+" "+twoTimes[i] + " "+twoTimes[j]);
if(twoTimes[i] + twoTimes[j] > limit){
break;
}
result = Math.max(result, twoTimes[i] + twoTimes[j]);
}
}
return result;
}
}
| a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Arrays;
| ^~~~~~
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.util.Scanner;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: expected unqualified-id before 'public'
5 | public class Main {
| ^~~~~~
|
s458728630 | p00452 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int m, n, p[1000], pp[1000*1000];
int main(){
while( true ){
cin >> n >> m;
if( m == 0 && n == 0 ) break;
for(int i = 0; i < n; i++){
cin >> p[i];
}
sort(p, p+n);
for(int i = 0; i < n*n; i++){
pp[i] = p[i/n] + p[i%n];
}
sort(pp, pp + n*n);
int c = n/p[n-1];
if( c >= 4 ){
cout << p[n-1]*4;
continue;
}
int cand = 0;
if( c <= 3 ){
int j = n*n-1;
for(int i = 0; i <= n*n/2 &&; i++){
while( pp[i] + pp[j] > m && j > 0 ) j--;
cand = max(cand, pp[i] + pp[j]);
}
}
if( c <= 2 ){
int j = n*n-1;
for(int i = 0; i <= n/2; i++){
while( p[i] + pp[j] > m && j > 0 ) j--;
cand = max(cand, p[i] + pp[j]);
}
}
if( c <= 1 ){
int j = n-1;
for(int i = 0; i <= n/2; i++){
while( p[i] + p[j] > m && j > 0 ) j--;
cand = max(cand, p[i] + p[j]);
}
}
int k;
for(k = n-1; p[k] > m && k > 0; k--);
cand = max(cand, p[k]);
cout << cand << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:27:41: error: expected primary-expression before ';' token
27 | for(int i = 0; i <= n*n/2 &&; i++){
| ^
|
s751750350 | p00452 | C++ | #include<iostream>
using namespace std;
int main() { | a.cc: In function 'int main()':
a.cc:4:13: error: expected '}' at end of input
4 | int main() {
| ~^
|
s143983332 | p00452 | C++ | #include <cstdio>
#include <fstream>
#include <algorithm>
using namespace std;
#define MAX_N 1000
int P[MAX_N + 1];
int N, M;
int table[5][MAX_N + 1];
int dfs(int a, int b, int c){
if(c > M) return P[b] * -1;
if(a == 0) return P[b];
if(table[a][b] >= 0) return table[a][b];
int cho = b;
while(cho <= N){
int d = dfs(a - 1, cho, c + P[b]) + P[b];
table[a][b] = max(table[a][b], (d > M)? 0 : d);
cho++;
}
return table[a][b];
}
int main(){
ifstream ifs("input.txt");
for(int i = 0; i < 5; i++){
for(int j = 0; j <= MAX_N; j++){
table[i][j] = -1;
}
}
ifs >> N >> M;
p[0] = 0;
for(int i = 1; i <= N; i++) ifs >> P[i];
printf("%d\n", dfs(4, 0, 0));
return 0;
} | a.cc: In function 'int main()':
a.cc:37:9: error: 'p' was not declared in this scope
37 | p[0] = 0;
| ^
|
s203085242 | p00452 | C++ | #include<iostream>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
int t[n];
for(int i=0;i<n;i++){
cin>>t[i];
}
int ans=0;
int max=0;
sort(t,t+n);
for(int i=n-1;i>=0;){
if(ans+t[i]>=m){
i--;
continue;
}
ans+=t[i];
//cout<<"ans "<<ans<<endl;
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(t,t+n);
| ^~~~
| short
|
s906739819 | p00452 | C++ | 4 50
3
14
15
9
3 21
16
11
2
0 0 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 4 50
| ^
|
s966268470 | p00452 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
while(cin >> N >> M, N + M > 0) {
int N, M;
int P[1111];
vector<int> PP;
for(int i= 0; i < N; i++) {
cin >> P[i];
}
P[N++] = 0;
for(int i = 0; i < N; i++) {
for(int j = 0; j < N; j++) {
PP.push_back(P[i] + P[j]);
}
}
sort(PP.begin(), PP.end());
int ans = 0;;
for(int i = 0, m; i < PP.size(); i++) {
m = M - PP[i];
if(m < 0) continue;
int it = *(upper_bound(PP.begin(), PP.end(), m) - 1);
ans = max(ans, PP[i] + it );
//cout << PP[i] << " " << it << endl;
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:22: error: 'N' was not declared in this scope
8 | while(cin >> N >> M, N + M > 0) {
| ^
a.cc:8:27: error: 'M' was not declared in this scope
8 | while(cin >> N >> M, N + M > 0) {
| ^
|
s064296225 | p00452 | C++ | #include<iostream>
#include<set>
#include<vector>
using namespace std;
int binary(vector<int> &a, int tar){
int begin = 0, end = a.size() - 1, mid = (begin + end)/2;
while(begin < mid){
if(a[mid] < tar){
begin = mid;
}else{
end = mid;
}
mid = (begin + end)/2;
}
return a[mid];
}
int main(int argc, char *argv[]){
int n, m;
while(scanf("%d %d\n", &n, &m)){
if(n == 0 && m == 0)break;
int point[n + 1];
point[0] = 0;
vector<int> a;
for (int i = 1; i <= n; i++) {
scanf("%d\n", &point[i]);
}
for (int i = 0; i <= n; i++) {
for (int j = 0; j <= n; j++) {
a.push_back(point[i] + point[j]);
}
}
sort(a.begin(), a.end());
int ans = 0;
for (int i: a){
int tmp = binary(a, m - i);
if(i + tmp <= m)
ans = max(ans, i + tmp);
}
std::cout << ans << std::endl;
}
return 0;
} | a.cc: In function 'int main(int, char**)':
a.cc:35:5: error: 'sort' was not declared in this scope; did you mean 'short'?
35 | sort(a.begin(), a.end());
| ^~~~
| short
|
s830230157 | p00452 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<functional>
long long kazu[1002001];//1001^2
long long n,m,Max = 0,data[1001];
int main(){
while(std::cin>>n>>m, n * m){
if(n==0&&m==0)break;
memset(kazu, 0, sizeof(kazu));
memset(data, 0, sizeof(data));
for(int i=0;i<n;i++){
std::cin >> data[i+1];
}
for(int c=0;c<n+1;c++){
for(int d=0;d<n+1;d++){
kazu[c*n+d]=data[c]+data[d];
}
}
std::sort(kazu,kazu+(n+1)*(n+1));
long long* ptr;
for(int i = 0; i < (n + 1) * (n + 1);++i){
if(kazu[i] < m){
ptr = std::upper_bound(kazu, kazu + (n + 1) * (n + 1), m - kazu[i]) - 1;
Max = std::max(Max, *ptr + kazu[i]);
}
}
std::cout << Max << std::endl;
Max = 0;
return 0;
} | a.cc: In function 'int main()':
a.cc:13:17: error: 'memset' was not declared in this scope
13 | memset(kazu, 0, sizeof(kazu));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<functional>
+++ |+#include <cstring>
5 |
a.cc:38:2: error: expected '}' at end of input
38 | }
| ^
a.cc:9:11: note: to match this '{'
9 | int main(){
| ^
|
s045132289 | p00452 | C++ | #include <iostream>
#include <queue>
using namespace std;
const int MAX_M = 100000000;
int n, m, p[1000], save;
bool dp[MAX_M];
queue <int> que;
int main() {#include <iostream>
#include <queue>
using namespace std;
const int MAX_M = 100000000;
int n, m, p[1000], save;
bool dp[MAX_M+1];
queue <int> que;
int main() {
while (cin >> n >> m){
for (int i = 0; i<n; i++){
cin >> p[i];
}
for(int i=0;i<m;i++){
dp[i]=0;
}
dp[0] = 1;
que.push(0);
for (int i = 0; i<n; i++){
dp[p[i]] = 1;
que.push(p[i]);
}
for (int i = 1; i<4; i++){
save=que.size();
for (int k=0;k<save;k++){
for (int j = 0; j < n; j++){
if (que.front() + p[j] < m){
dp[que.front() + p[j]] = 1;
que.push(que.front() + p[j]);
}
}
que.pop();
}
}
for (int i = m - 1; i >= 0; i--){
if (dp[i] != 0){
cout << i << endl;
break;
}
}
}
return 0;
}
while (cin >> n >> m){
for (int i = 0; i<n; i++){
cin >> p[i];
}
for(int i=0;i<m;i++){
dp[i]=0;
}
dp[0] = 1;
que.push(0);
for (int i = 0; i<n; i++){
dp[p[i]] = 1;
que.push(p[i]);
}
for (int i = 1; i<4; i++){
save=que.size();
for (int k=0;k<save;k++){
for (int j = 0; j < n; j++){
if (que.front() + p[j] < m){
dp[que.front() + p[j]] = 1;
que.push(que.front() + p[j]);
}
}
que.pop();
}
}
for (int i = m - 1; i >= 0; i--){
if (dp[i] != 0){
cout << i << endl;
break;
}
}
}
return 0;
} | a.cc:8:13: error: stray '#' in program
8 | int main() {#include <iostream>
| ^
a.cc: In function 'int main()':
a.cc:8:14: error: 'include' was not declared in this scope
8 | int main() {#include <iostream>
| ^~~~~~~
a.cc:8:31: error: expected primary-expression before '>' token
8 | int main() {#include <iostream>
| ^
a.cc:10:1: error: expected primary-expression before 'using'
10 | using namespace std;
| ^~~~~
a.cc:15:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
15 | int main() {
| ^~
a.cc:15:9: note: remove parentheses to default-initialize a variable
15 | int main() {
| ^~
| --
a.cc:15:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:15:12: error: a function-definition is not allowed here before '{' token
15 | int main() {
| ^
|
s880593051 | p00452 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
int n;
long long int m;
while (cin >> n >> m) {
if (n == 0 && m == 0) {
break;
}
vector<long long int> data;
long long int b;
for (int i = 0; i < n; i++) {
cin >> b;
if (b <= m) {
data.push_back(m);
}
}
sort(data.begin(), data.end());
vector<long long int> data2;
for (int i = 0; i < data.size(); i++) {
for (int j = i; j < data.size(); j++) {
if (data[i]+data[j] <= m) {
data2.push_back(data[i]+data[j]);
} else {
break;
}
}
}
sort(data2.begin(), data2.end());
data.clear();
for (int i = 0; i < data2.size(); i++) {
for (int j = i; j < data2.size(); j++) {
if (data2[i]+data2[j] <= m) {
data.push_back(data2[i]+data2[j]);
} else {
break;
}
}
}
data2.clear();
sort(data.begin(), data.end());
vector<long long int> data2;
for (int i = 0; i < data.size(); i++) {
for (int j = i; j < data.size(); j++) {
if (data[i]+data[j] <= m) {
data2.push_back(data[i]+data[j]);
} else {
break;
}
}
}
sort(data2.begin(), data2.end());
long long int sz = data2.size();
cout << data2[sz-1] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:47:39: error: redeclaration of 'std::vector<long long int> data2'
47 | vector<long long int> data2;
| ^~~~~
a.cc:24:39: note: 'std::vector<long long int> data2' previously declared here
24 | vector<long long int> data2;
| ^~~~~
|
s517722631 | p00452 | C++ | #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;
#define pb(n) push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define REP(i,s,e) for(int i=(s); i<(e); i++)
#define rep(i,n) REP(i,0,n)
#define REPE(i,s,e) for(int i=s; i>e; i--)
#define repe(i,n) REPE(i,n,-1)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007
const int MAX_N = 1000;
const int MAX_W = 200000000;
int dp[MAX_N + 1][MAX_W + 1][5];
int v[MAX_N], w[MAX_N];
int N,W;
// int solve(int i, int j, int k){
// if(dp[i][j][k] != -1) return dp[i][j][k];
// int ret = 0;
// if(i == N) ret = 0;
// else if(j < w[i] || k == 4) ret =dp[i][j][k];
// else ret =max(max(solve(i,j,k),solve(i,j-w[i],k+1) + v[i]),solve(i+1,j-w[i],k + 1) + v[i]);
// return dp[i][j][k] = ret;
// }
int solve() {
for(int i = 0; i < N; i++) {
for(int j = 0; j <= W; j++){
for(int k = 0; k < 5; k++){
if(j < w[i] || k <1) {
dp[i + 1][j][k] = dp[i][j][k];
}
else{
dp[i + 1][j][k] = max(max(dp[i][j][k],dp[i][j-w[i]][k-1] + v[i]), dp[i + 1][j - w[i]][k-1] + v[i]);
}
}
}
}
return dp[N][W][4];
}
int main(){
int n, m;
while(cin>>n>>m){
N = n;
W = m;
// for(int i = 0; i<= N; i++){
// for(int j = 0; j <=W; j++){
// for(int k = 0; k < 4; k++){
// dp[i][j][k] = -1;
// }
// }
// }
for(int i = 0; i < n; i++){
cin >> v[i];
w[i] = v[i];
}
cout<<solve()<<endl;
}
} | /tmp/ccVt5TpW.o: in function `solve()':
a.cc:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccVt5TpW.o
a.cc:(.text+0xe1): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccVt5TpW.o
a.cc:(.text+0x135): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccVt5TpW.o
a.cc:(.text+0x151): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccVt5TpW.o
a.cc:(.text+0x1a7): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccVt5TpW.o
a.cc:(.text+0x262): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccVt5TpW.o
a.cc:(.text+0x275): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccVt5TpW.o
a.cc:(.text+0x284): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccVt5TpW.o
a.cc:(.text+0x28a): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccVt5TpW.o
/tmp/ccVt5TpW.o: in function `main':
a.cc:(.text+0x2ce): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccVt5TpW.o
a.cc:(.text+0x2d7): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s218397156 | p00452 | C++ | #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;
#define pb(n) push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define REP(i,s,e) for(int i=(s); i<(e); i++)
#define rep(i,n) REP(i,0,n)
#define REPE(i,s,e) for(int i=s; i>e; i--)
#define repe(i,n) REPE(i,n,-1)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007
const int MAX_N = 1000;
const int MAX_W = 200000000;
int dp[MAX_N + 1][MAX_W + 1][5];
int v[MAX_N], w[MAX_N];
int N,W;
int solve() {
for(int i = 0; i < N; i++) {
for(int j = 0; j <= W; j++){
for(int k = 0; k < 5; k++){
if(j < w[i] || k <1) {
dp[i + 1][j][k] = dp[i][j][k];
}
else{
dp[i + 1][j][k] = max(max(dp[i][j][k],dp[i][j-w[i]][k-1] + v[i]), dp[i + 1][j - w[i]][k-1] + v[i]);
}
}
}
}
return dp[N][W][4];
}
int main(){
int n, m;
while(cin>>n>>m){
N = n;
W = m;
for(int i = 0; i < n; i++){
cin >> v[i];
w[i] = v[i];
}
cout<<solve()<<endl;
}
} | /tmp/ccazbeA6.o: in function `solve()':
a.cc:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0xe1): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0x135): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0x151): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0x1a7): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0x262): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0x275): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0x284): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0x28a): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccazbeA6.o
/tmp/ccazbeA6.o: in function `main':
a.cc:(.text+0x2ce): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccazbeA6.o
a.cc:(.text+0x2d7): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s485466328 | p00452 | C++ | #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;
#define pb(n) push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define REP(i,s,e) for(int i=(s); i<(e); i++)
#define rep(i,n) REP(i,0,n)
#define REPE(i,s,e) for(int i=s; i>e; i--)
#define repe(i,n) REPE(i,n,-1)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007
const int MAX_N = 1000;
const int MAX_W = 200000000;
int dp[MAX_N + 1][MAX_W + 1][5];
int v[MAX_N], w[MAX_N];
int N,W;
int solve() {
for(int i = 0; i < N; i++) {
for(int j = 0; j <= W; j++){
for(int k = 0; k < 5; k++){
if(j < w[i] || k <1) {
dp[i + 1][j][k] = dp[i][j][k];
}
else{
dp[i + 1][j][k] = max(max(dp[i][j][k],dp[i][j-w[i]][k-1] + v[i]), dp[i + 1][j - w[i]][k-1] + v[i]);
}
}
}
}
return dp[N][W][4];
}
int main(){
int n, m;
while(cin>>n>>m){
N = n;
W = m;
for(int i = 0; i < n; i++){
cin >> v[i];
w[i] = v[i];
}
cout<<solve()<<endl;
}
} | /tmp/ccc57zMh.o: in function `solve()':
a.cc:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0xe1): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0x135): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0x151): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0x1a7): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0x262): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0x275): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0x284): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0x28a): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccc57zMh.o
/tmp/ccc57zMh.o: in function `main':
a.cc:(.text+0x2ce): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccc57zMh.o
a.cc:(.text+0x2d7): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s841848080 | p00452 | C++ | #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;
#define pb(n) push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define REP(i,s,e) for(int i=(s); i<(e); i++)
#define rep(i,n) REP(i,0,n)
#define REPE(i,s,e) for(int i=s; i>e; i--)
#define repe(i,n) REPE(i,n,-1)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007
const int MAX_N = 1000;
const int MAX_W = 200000000;
int dp[MAX_N + 1][MAX_W + 1][5];
int v[MAX_N], w[MAX_N];
int N,W;
int solve() {
for(int i = 0; i < N; i++) {
for(int j = 0; j <= W; j++){
for(int k = 0; k < 5; k++){
if(j < w[i] || k <1) {
dp[i + 1][j][k] = dp[i][j][k];
}
else{
dp[i + 1][j][k] = max(/*max(*/dp[i][j][k]/*,dp[i][j-w[i]][k-1] + v[i])*/, dp[i + 1][j - w[i]][k-1] + v[i]);
}
}
}
}
return dp[N][W][4];
}
int main(){
int n, m;
while(cin>>n>>m){
N = n;
W = m;
for(int i = 0; i < n; i++){
cin >> v[i];
w[i] = v[i];
}
cout<<solve()<<endl;
}
} | /tmp/cc59VyHz.o: in function `solve()':
a.cc:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0xe1): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0x135): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0x1de): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0x1f1): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0x200): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0x206): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/cc59VyHz.o
/tmp/cc59VyHz.o: in function `main':
a.cc:(.text+0x24a): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0x253): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0x270): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc59VyHz.o
a.cc:(.text+0x299): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s004267342 | p00452 | C++ | #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;
#define pb(n) push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define REP(i,s,e) for(int i=(s); i<(e); i++)
#define rep(i,n) REP(i,0,n)
#define REPE(i,s,e) for(int i=s; i>e; i--)
#define repe(i,n) REPE(i,n,-1)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007
const int MAX_N = 1000;
const int MAX_W = 200000000;
// int dp[MAX_N + 1][MAX_W + 1][5];
// int v[MAX_N], w[MAX_N];
// int N,W;
// int solve() {
// for(int i = 0; i < N; i++) {
// for(int j = 0; j <= W; j++){
// for(int k = 0; k < 5; k++){
// if(j < w[i] || k <1) {
// dp[i + 1][j][k] = dp[i][j][k];
// }
// else{
// dp[i + 1][j][k] = max(/*max(*/dp[i][j][k]/*,dp[i][j-w[i]][k-1] + v[i])*/, dp[i + 1][j - w[i]][k-1] + v[i]);
// }
// }
// }
// }
// return dp[N][W][4];
// }
int dp[MAX_W + 1][5];
int solve(){
for(int i = 0; i < N; i++){
for(int j = w[i]; j <= W; j++){
for(int k = 0; k < 5; k++){
if(k>=1)dp[j][k] = max(dp[j][k], dp[j-w[i]][k-1] + v[i]);
}
}
}
}
int main(){
int n, m;
while(cin>>n>>m){
N = n;
W = m;
for(int i = 0; i < n; i++){
cin >> v[i];
w[i] = v[i];
}
cout<<solve()<<endl;
}
} | a.cc: In function 'int solve()':
a.cc:73:28: error: 'N' was not declared in this scope
73 | for(int i = 0; i < N; i++){
| ^
a.cc:74:29: error: 'w' was not declared in this scope
74 | for(int j = w[i]; j <= W; j++){
| ^
a.cc:74:40: error: 'W' was not declared in this scope
74 | for(int j = w[i]; j <= W; j++){
| ^
a.cc:76:84: error: 'v' was not declared in this scope
76 | if(k>=1)dp[j][k] = max(dp[j][k], dp[j-w[i]][k-1] + v[i]);
| ^
a.cc:80:1: warning: no return statement in function returning non-void [-Wreturn-type]
80 | }
| ^
a.cc: In function 'int main()':
a.cc:85:9: error: 'N' was not declared in this scope
85 | N = n;
| ^
a.cc:86:9: error: 'W' was not declared in this scope
86 | W = m;
| ^
a.cc:88:20: error: 'v' was not declared in this scope
88 | cin >> v[i];
| ^
a.cc:89:13: error: 'w' was not declared in this scope
89 | w[i] = v[i];
| ^
|
s602562581 | p00452 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
int n, m, point1[1001], sum, ans;
vector<int> point2;
int solve(int start, int end, int border){
int mid;
while(1){
if((end + start) % 2){
mid = (end + start) / 2 + 1;
} else{
mid = (end + start) / 2;
}
if(point2[mid] > border){
end = mid;
} else{
start = mid;
}
if(end - start == 1){
if(point2[end] < border){
return point2[end];
} else{
return point2[start];
}
}
}
}
int main(){
while(cin >> n >> m && n && m){
for(int i = 0; i < n; i++){
cin >> point1[i];
}
for(int i = 0; i < n + 1; i++){
for(int j = 0; j < n + 1; j++){
point2.push_back(point1[i] + point1[j]);
}
}
sort(point1, point1 + n + 1);
sort(point2.begin(), point2.end());
for(int i = 0; i < n + 1; i++){
if(point2[i] > m){
continue;
}
ans = max(ans, points2[i] + solve(0, point2.size() - 1, m - point2[i]));
}
cout << ans << endl;
memset(point1, 0, sizeof(point1));
point2.clear();
ans = 0;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:53:28: error: 'points2' was not declared in this scope; did you mean 'point2'?
53 | ans = max(ans, points2[i] + solve(0, point2.size() - 1, m - point2[i]));
| ^~~~~~~
| point2
|
s211233721 | p00452 | C++ | #include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ZERO(a) memset(a,0,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define INF 1<<29
#define MAX 1010
using namespace std;
int p[MAX];
void solve(){
int n,m,ind;
for(;;){
cin>>n>m;
if(!n) break;
int ma=0;
vector<int> v;
FOR(i,n){
cin>>p[i];
v.pb(p[i]);
}
FOR(i,n){
FORR(j,i,n){
v.pb(a[i]+a[j]);
}
}
sort(v.begin(),v.end());
erase(unique(v.begin(),v.end()),v.end());
ind=upper_bound(v.begin(),v.end(),m)-1;
if(ind>=0) ma=v[ind];
FOR(i,v.size()){
ind=upper_bound(v.begin(),v.end(),m-v[i])-1;
if(ind>=0) ma=max(ma,v[i]+v[ind]);
}
cout<<ma<<endl;
}
}
int main(){
solve();
return 0;
} | a.cc: In function 'void solve()':
a.cc:19:9: error: no match for 'operator>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int')
19 | cin>>n>m;
| ~~~~~~^~
| | |
| | int
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
a.cc:19:9: note: candidate: 'operator>(int, int)' (built-in)
19 | cin>>n>m;
| ~~~~~~^~
a.cc:19:9: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed:
a.cc:19:10: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
19 | cin>>n>m;
| ^
/usr/include/c++/14/bits/regex.h:1236:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed:
a.cc:19:10: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
19 | cin>>n>m;
| ^
/usr/include/c++/14/bits/regex.h:1329:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1329 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed:
a.cc:19:10: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
19 | cin>>n>m;
| ^
/usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed:
a.cc:19:10: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
19 | cin>>n>m;
| ^
/usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1497 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed:
a.cc:19:10: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
19 | cin>>n>m;
| ^
/usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed:
a.cc:19:10: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
19 | cin>>n>m;
| ^
/usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1673 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed:
a.cc:19:10: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
19 | cin>>n>m;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:19:10: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>'
19 | cin>>n>m;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:19:10: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
19 | cin>>n>m;
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:19:10: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
19 | cin>>n>m;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:19:10: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
19 | cin>>n>m;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:19:10: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
19 | cin>>n>m;
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:19:10: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
19 | cin>>n>m;
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:19:10: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
19 | cin>>n>m;
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:19:10: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
19 | cin>>n>m;
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution f |
s206760682 | p00452 | C++ | #include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ZERO(a) memset(a,0,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define INF 1<<29
#define MAX 1010
using namespace std;
int p[MAX];
void solve(){
int n,m,ind;
for(;;){
cin>>n>>m;
if(!n) break;
int ma=0;
vector<int> v;
FOR(i,n){
cin>>p[i];
v.pb(p[i]);
}
FOR(i,n){
FORR(j,i,n){
v.pb(a[i]+a[j]);
}
}
sort(v.begin(),v.end());
erase(unique(v.begin(),v.end()),v.end());
ind=upper_bound(v.begin(),v.end(),m)-1;
if(ind>=0) ma=v[ind];
FOR(i,v.size()){
ind=upper_bound(v.begin(),v.end(),m-v[i])-1;
if(ind>=0) ma=max(ma,v[i]+v[ind]);
}
cout<<ma<<endl;
}
}
int main(){
solve();
return 0;
} | a.cc: In function 'void solve()':
a.cc:29:10: error: 'a' was not declared in this scope
29 | v.pb(a[i]+a[j]);
| ^
a.cc:4:25: note: in definition of macro 'pb'
4 | #define pb(a) push_back(a)
| ^
a.cc:33:3: error: 'erase' was not declared in this scope
33 | erase(unique(v.begin(),v.end()),v.end());
| ^~~~~
a.cc:34:39: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in assignment
34 | ind=upper_bound(v.begin(),v.end(),m)-1;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
| |
| __gnu_cxx::__normal_iterator<int*, std::vector<int> >
a.cc:37:45: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in assignment
37 | ind=upper_bound(v.begin(),v.end(),m-v[i])-1;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
| |
| __gnu_cxx::__normal_iterator<int*, std::vector<int> >
|
s108246450 | p00452 | C++ | #include <bits/stdc++.h>
using namespace std ;
#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;
const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};
inline bool value(int x,int y,int w,int h){
return (x >= 0 && x < w && y >= 0 && y < h);
}
template<typename T>
void Unique(vector<T> &v){
sort(all(v));
v.erase(unique(all(v)),v.end());
}
template<typename T>
T ston(string& str, T n){
istringstream sin(str) ;
T num ;
sin >> num ;
return num ;
}
void Ans(bool f){
if(f) cout << "YES"<<endl;
else cout << "NO"<<endl;
}
vector<vector<ll>> dp;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll n,m;
while(cin >> n >> m && n && m){
vary(ll,s,n,0);
dp = dp(n+2,vector<ll>(m+2,inf));
rep(i,n){
cin >> s[i];
}
sort(all(s));
rep(i,m+1){
dp[0][i] = 0;
}
rep(i,n+1){
dp[i][0] = 0;
}
REP(i,0,n){
for(ll j = 0; j < m+1 + s[i]; j += s[i]){
if(j - s[i] >= 0){
dp[i+1][j] = min(dp[i+1][j],dp[i][j-s[i]]+1);
}
}
if(i > 0){
rep(j,m+1){
dp[i+1][j] = min(dp[i][j],dp[i+1][j]);
}
}
}
ll ans = 0;
for(ll j = n; j >= 0; --j){
for(ll i = m; i >= 0; --i){
if(dp[j][i] != inf && dp[j][i] != 0 && dp[j][i] <= m){
ans = i;
j = -1;
break;
}
}
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:66:12: error: no match for call to '(std::vector<std::vector<long long int> >) (ll, std::vector<long long int>)'
66 | dp = dp(n+2,vector<ll>(m+2,inf));
| ~~^~~~~~~~~~~~~~~~~~~~~~~~~
|
s417152650 | p00452 | C++ | #include<iostream>
using namespace std;
int p[1001],s[1000000];
int main(){
int n,m;
cin>>n>>m;
int top=1;
p[0]=0,s[0]=0;
for(int i=1;i<=n;i++){
cin>>p[i];
for(int j=0;j<i;j++){
if(p[i]+p[j]<=m){s[top]=p[i]+p[j]top++;}
}
}
int ans=0;
for(int i=0;i<top;i++){
int left=0,right=top,mid;
while(true){
if(left>=right-1)break;
mid=(left+right)/2;
if(s[mid]+s[i]<=m){ans=max(ans,s[mid]+s[i]),left=mid;}
else right=mid;
}
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:58: error: expected ';' before 'top'
12 | if(p[i]+p[j]<=m){s[top]=p[i]+p[j]top++;}
| ^~~
| ;
|
s560604126 | p00452 | C++ | 4 50
3
14
15
9
3 21
16
11
2 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 4 50
| ^
|
s312102740 | p00452 | C++ | #include <bits/stdc++.h>
using namespace std;
#define INF 100000005
#define MAX 1002
long long p[MAX], dp[MAX];
int main(){
long long n, m, ans;
while(cin >> n >> m, n){
fill(dp, dp+MAX, 0);
for(int i = 0;i < n;i++)cin >> p[i];
ans = 0;
for(int i = 0;i < 3;i++){
dp[0] = 5;
for(int j = p[i];j <= m;j++){
dp[j] = max(dp[j], dp[j-p[i]]-1);
if(dp[j])ans = max(ans, j);
}
}
//for(int i = 1;i <= 50;i++)cout << dp[i] << endl;
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:51: error: no matching function for call to 'max(long long int&, int&)'
18 | if(dp[j])ans = max(ans, j);
| ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:18:51: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
18 | if(dp[j])ans = max(ans, 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:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:18:51: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
18 | if(dp[j])ans = max(ans, j);
| ~~~^~~~~~~~
|
s244138210 | p00452 | C++ | //http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2676345#1
//http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2676345#1
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
#include<fstream>
#include<cstring>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define P pair<int,int>
#define ll __int64
ll n,m;
ll t[10000];
const int MA=1000000;
ll s1[MA],s2[MA];
int main(){
while(cin>>n>>m,n||m){
rep(i,MA)s1[i]=s2[i]=0;
rep(i,10000)t[i]=0;
for(int i=1;i<=n;i++)cin>>t[i];
int g=0;
for(int i=0;i<=n;i++){
for(int j=0;j<=n;j++){
s1[i*(n+1)+j]=t[i]+t[j];
g++;
}
}
sort(s1,s1+g);
rep(i,g)s2[i]=s1[i];
int ans=0;
for(int i=0;i<g;i++){
int now=s1[i];
int l=0;
int r=g-1;
int mid=(l+r)/2;
int x=s2[mid];
for(int i=0;i<70;i++){
if(x+now==m)break;
if(l>r)break;
if(x+now>m){
r=mid;
mid=(r+l)/2;
x=s2[mid];
}
else{
l=mid;
mid=(r+l)/2;
x=s2[mid];
}
}
//cout<<" "<<x<<" "<<now<<" "<<x+now<<endl;
if(x+now<=m)
ans=max(ans,x+now);
}
cout<<ans<<endl;
}
return 0;
}
| a.cc:19:12: error: '__int64' does not name a type; did you mean '__int64_t'?
19 | #define ll __int64
| ^~~~~~~
a.cc:21:1: note: in expansion of macro 'll'
21 | ll n,m;
| ^~
a.cc:19:12: error: '__int64' does not name a type; did you mean '__int64_t'?
19 | #define ll __int64
| ^~~~~~~
a.cc:22:1: note: in expansion of macro 'll'
22 | ll t[10000];
| ^~
a.cc:19:12: error: '__int64' does not name a type; did you mean '__int64_t'?
19 | #define ll __int64
| ^~~~~~~
a.cc:24:1: note: in expansion of macro 'll'
24 | ll s1[MA],s2[MA];
| ^~
a.cc: In function 'int main()':
a.cc:29:12: error: 'n' was not declared in this scope
29 | while(cin>>n>>m,n||m){
| ^
a.cc:29:15: error: 'm' was not declared in this scope; did you mean 'tm'?
29 | while(cin>>n>>m,n||m){
| ^
| tm
a.cc:30:10: error: 's1' was not declared in this scope
30 | rep(i,MA)s1[i]=s2[i]=0;
| ^~
a.cc:30:16: error: 's2' was not declared in this scope
30 | rep(i,MA)s1[i]=s2[i]=0;
| ^~
a.cc:31:13: error: 't' was not declared in this scope
31 | rep(i,10000)t[i]=0;
| ^
a.cc:33:27: error: 't' was not declared in this scope
33 | for(int i=1;i<=n;i++)cin>>t[i];
| ^
a.cc:38:17: error: 's1' was not declared in this scope
38 | s1[i*(n+1)+j]=t[i]+t[j];
| ^~
a.cc:38:31: error: 't' was not declared in this scope
38 | s1[i*(n+1)+j]=t[i]+t[j];
| ^
a.cc:44:6: error: 's1' was not declared in this scope
44 | sort(s1,s1+g);
| ^~
a.cc:45:9: error: 's2' was not declared in this scope
45 | rep(i,g)s2[i]=s1[i];
| ^~
a.cc:55:15: error: 's2' was not declared in this scope
55 | int x=s2[mid];
| ^~
|
s383244834 | p00452 | C++ | //http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2676345#1
//http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2676345#1
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
#include<fstream>
#include<cstring>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define P pair<int,int>
#define ll __int64
ll n,m;
ll t[10000];
const int MA=1000000;
ll s1[MA];
ll s2[MA];
int main(){
while(cin>>n>>m,n||m){
rep(i,MA)s1[i]=s2[i]=0;
rep(i,10000)t[i]=0;
for(int i=1;i<=n;i++)cin>>t[i];
int g=0;
for(int i=0;i<=n;i++){
for(int j=0;j<=n;j++){
s1[i*(n+1)+j]=t[i]+t[j];
g++;
}
}
sort(s1,s1+g);
rep(i,g)s2[i]=s1[i];
int ans=0;
for(int i=0;i<g;i++){
int now=s1[i];
int l=0;
int r=g-1;
int mid=(l+r)/2;
int x=s2[mid];
for(int i=0;i<70;i++){
if(x+now==m)break;
if(l>r)break;
if(x+now>m){
r=mid;
mid=(r+l)/2;
x=s2[mid];
}
else{
l=mid;
mid=(r+l)/2;
x=s2[mid];
}
}
//cout<<" "<<x<<" "<<now<<" "<<x+now<<endl;
if(x+now<=m)
ans=max(ans,x+now);
}
cout<<ans<<endl;
}
return 0;
}
| a.cc:19:12: error: '__int64' does not name a type; did you mean '__int64_t'?
19 | #define ll __int64
| ^~~~~~~
a.cc:21:1: note: in expansion of macro 'll'
21 | ll n,m;
| ^~
a.cc:19:12: error: '__int64' does not name a type; did you mean '__int64_t'?
19 | #define ll __int64
| ^~~~~~~
a.cc:22:1: note: in expansion of macro 'll'
22 | ll t[10000];
| ^~
a.cc:19:12: error: '__int64' does not name a type; did you mean '__int64_t'?
19 | #define ll __int64
| ^~~~~~~
a.cc:24:1: note: in expansion of macro 'll'
24 | ll s1[MA];
| ^~
a.cc:19:12: error: '__int64' does not name a type; did you mean '__int64_t'?
19 | #define ll __int64
| ^~~~~~~
a.cc:25:1: note: in expansion of macro 'll'
25 | ll s2[MA];
| ^~
a.cc: In function 'int main()':
a.cc:30:12: error: 'n' was not declared in this scope
30 | while(cin>>n>>m,n||m){
| ^
a.cc:30:15: error: 'm' was not declared in this scope; did you mean 'tm'?
30 | while(cin>>n>>m,n||m){
| ^
| tm
a.cc:31:10: error: 's1' was not declared in this scope
31 | rep(i,MA)s1[i]=s2[i]=0;
| ^~
a.cc:31:16: error: 's2' was not declared in this scope
31 | rep(i,MA)s1[i]=s2[i]=0;
| ^~
a.cc:32:13: error: 't' was not declared in this scope
32 | rep(i,10000)t[i]=0;
| ^
a.cc:34:27: error: 't' was not declared in this scope
34 | for(int i=1;i<=n;i++)cin>>t[i];
| ^
a.cc:39:17: error: 's1' was not declared in this scope
39 | s1[i*(n+1)+j]=t[i]+t[j];
| ^~
a.cc:39:31: error: 't' was not declared in this scope
39 | s1[i*(n+1)+j]=t[i]+t[j];
| ^
a.cc:45:6: error: 's1' was not declared in this scope
45 | sort(s1,s1+g);
| ^~
a.cc:46:9: error: 's2' was not declared in this scope
46 | rep(i,g)s2[i]=s1[i];
| ^~
a.cc:56:15: error: 's2' was not declared in this scope
56 | int x=s2[mid];
| ^~
|
s312594779 | p00452 | C++ | #include "algorithm"
#include "array"
#include "cmath"
#include "complex"
#include "cstdio"
#include "deque"
#include "initializer_list"
#include "map"
#include "numeric"
#include "queue"
#include "regex"
#include "set"
#include "stack"
#include "string"
#include "unordered_map"
#include "vector"
using std::accumulate;
using std::all_of;
using std::any_of;
using std::array;
using std::binary_search;
using std::copy;
using std::count_if;
using std::deque;
using std::fill;
using std::find_if;
using std::for_each;
using std::inner_product;
using std::lower_bound;
using std::map;
using std::max;
using std::min;
using std::multimap;
using std::multiset;
using std::next_permutation;
using std::none_of;
using std::priority_queue;
using std::queue;
using std::regex;
using std::search;
using std::set;
using std::sort;
using std::sregex_token_iterator;
using std::stable_sort;
using std::stack;
using std::string;
using std::swap;
using std::to_string;
using std::transform;
using std::unordered_map;
using std::upper_bound;
using std::vector;
#define INF 1000000000 // 10^10
#define FOR(i, n) for ((i) = 0; (i) < (n); ++(i))
#define FOR_FROM_NOT_ZERO(i, s, n) for ((i) = (s); (i) < (n); ++(i))
#define FOR_dec(i, n) for ((i) = (n); (i) >= 0; --(i))
typedef long long ll;
#define all(x) (x).begin(), (x).end()
#define d2_arr(height, width) array<array<int, (width)>, (height)>
#define d2_vec vector<vector<int>>
#define in_int(x) scanf(" %d/n", &(x));
#define in_str(x) scanf(" %[a-zA-Z 0-9_]/n", (x));
#define ch(x) printf("debag %d\n", (x))
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, -1, 1};
int dx_ar[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy_ar[] = {1, 0, -1, 1, -1, 1, 0, -1};
template <typename type> void print_array_vertical(type d1_arr);
template <typename type> void print_array_horizon(type d1_arr);
template <typename type> void print_2darray(type d2_arr);
vector<vector<int>> d2_zeros(int height, int width);
vector<vector<int>> padding(vector<vector<int>> arr, int pad);
inline vector<int> str_int_split(char *s);
inline std::vector<std::vector<int>> in_d2_arr(int N, int size = 1000);
inline std::vector<int> in_d1_arr(int size = 1000);
inline double d2_distance(int x1, int y1, int x2, int y2);
inline int d2_manhattan(int x1, int y1, int x2, int y2);
int main() {
int i, N, M, temp;
std::vector<int> v = in_d1_arr();
N = v[0];
M = v[1];
std::vector<int> tar;
FOR(i, N) {
in_int(temp);
tar.push_back(temp);
}
sort(tar.begin(), tar.end(), std::greater<int>());
int point = 0;
FOR(i, 4) {
FOR(i, N) {
if (point + tar[i] <= M) {
point = point + tar[i];
break;
}
}
}
printf("%d\n", point);
return 0;
}
template <typename type> void print_array_vertical(type d1_arr) {
int i;
string s;
FOR(i, d1_arr.size()) {
printf("%d\n", d1_arr[i]);
fflush(stdout);
}
}
template <typename type> void print_array_horizon(type d1_arr) {
int i;
FOR(i, d1_arr.size() - 1) { printf("%d ", d1_arr[i]); }
printf("%d\n", d1_arr.back());
fflush(stdout);
}
template <typename type> void print_2darray(type d2_arr) {
int i, j;
FOR(i, d2_arr.size()) {
FOR(j, d2_arr[i].size() - 1) { printf("%d ", d2_arr[i][j]); }
printf("%d\n", d2_arr[i].back());
fflush(stdout);
}
}
vector<vector<int>> d2_zeros(int height, int width) {
vector<vector<int>> temp;
temp.resize(height);
int i, j;
FOR(i, height) {
temp[i].resize(width);
FOR(j, width) { temp[i][j] = 0; }
}
return temp;
}
vector<vector<int>> padding(vector<vector<int>> arr, int pad) {
vector<vector<int>> arr_c = arr;
int height = arr_c.size();
int width = arr_c[0].size();
std::vector<int> v;
v.resize(width);
fill(v.begin(), v.end(), pad);
arr_c.insert(arr_c.begin(), v);
arr_c.push_back(v);
int i;
FOR(i, height + 2) {
arr_c[i].insert(arr_c[i].begin(), pad);
arr_c[i].resize(width + 2);
}
arr_c.shrink_to_fit();
return arr_c;
}
inline vector<int> str_int_split(char *s) {
char *tok = strtok(s, " ");
std::vector<int> v;
while (tok != NULL) {
v.push_back(atoi(tok));
tok = strtok(NULL, " "); /* 2回目以降 */
}
return v;
}
inline std::vector<std::vector<int>> in_d2_arr(int N, int size) {
int i;
std::vector<std::vector<int>> v;
FOR(i, N) {
char *lines;
lines = new char[size];
in_str(lines);
v.push_back(str_int_split(lines));
delete[] lines;
}
return v;
}
inline std::vector<int> in_d1_arr(int size) {
std::vector<int> v;
char *lines;
lines = new char[size];
in_str(lines);
v = str_int_split(lines);
delete[] lines;
return v;
}
inline double d2_distance(int x1, int y1, int x2, int y2) {
return sqrt(pow((x2 - x1), 2) + pow((y2 - y1), 2));
}
inline int d2_manhattan(int x1, int y1, int x2, int y2) {
return (abs(x2 - x1) + abs(y2 - y1));
}
| a.cc: In function 'std::vector<int> str_int_split(char*)':
a.cc:167:15: error: 'strtok' was not declared in this scope; did you mean 'strtoq'?
167 | char *tok = strtok(s, " ");
| ^~~~~~
| strtoq
|
s822138322 | p00452 | C++ | a
| a.cc:1:1: error: 'a' does not name a type
1 | a
| ^
|
s735862852 | p00452 | 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
| |
s943891001 | p00452 | C++ | #include<stdio.h>
#include<iostream>
int main(){
int i,j,n,m,s=0,o;
static int ,p[1001],v[1001*1001]={0};
scanf("%d%d",&n,&m);
if(n==0&&m==0)return 0;
o=n+1;
for(i=1;i<=n;i++){
scanf("%d",&p[i]);
v[i]=p[i];
}
for(i=0;i<=n;i++){
for(j=i;j<=n;j++){
v[o]=p[i]+p[j];
o++;
}
}
for(i=0;i<o;i++){
for(j=i;j<o;j++){
if(v[i]+v[j]>s&&v[i]+v[j]<=m)s=v[i]+v[j];
}
}
printf("%d\n",s);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:5:12: error: expected unqualified-id before ',' token
5 | static int ,p[1001],v[1001*1001]={0};
| ^
a.cc: At global scope:
a.cc:26:1: error: expected unqualified-id before 'return'
26 | return 0;
| ^~~~~~
a.cc:27:1: error: expected declaration before '}' token
27 | }
| ^
|
s658372099 | p00452 | C++ | #include<stdio.h>
#include<iostream>
int main(){
while(1){
int i,j,n,m,s=0,o;
static int ,p[1001],v[1001*1001]={0};
scanf("%d%d",&n,&m);
if(n==0&&m==0)return 0;
o=n+1;
for(i=1;i<=n;i++){
scanf("%d",&p[i]);
v[i]=p[i];
}
for(i=0;i<=n;i++){
for(j=i;j<=n;j++){
v[o]=p[i]+p[j];
o++;
}
}
for(i=0;i<o;i++){
for(j=i;j<o;j++){
if(v[i]+v[j]>s&&v[i]+v[j]<=m)s=v[i]+v[j];
}
}
printf("%d\n",s);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:6:12: error: expected unqualified-id before ',' token
6 | static int ,p[1001],v[1001*1001]={0};
| ^
|
s908242381 | p00452 | C++ | #include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
while(1){
int i,j,n,m,s=0,o=1d=0;
static int p[1001]={0},up[1001*1001]={0};
scanf("%d%d",&n,&m);
if(n==0&&m==0)return 0;
up[0]=0;
for(i=1;i<=n;i++){
scanf("%d",&p[i]);
for(j=i;j>=0;j--){
up[o]=p[i]+p[j];
o++;
}
}
sort(up,up+o);
for(i=0;i<o;i++){
for(j=i;up[i]+up[j]<m&&j<o;j++);
if(up[i]+up[j-1]<=m)s=max(s,up[i]+up[j-1]);
}
printf("%d\n",s);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:35: error: unable to find numeric literal operator 'operator""d'
7 | int i,j,n,m,s=0,o=1d=0;
| ^~
|
s060050028 | p00452 | C++ | #include<algorithm>
#include<vector>
#define MAX_N 1001
using namespace std;
int main(void){
while( 1 ){
int n, m;
int V[MAX_N] = {0,};
int D[MAX_N][4] = {0,{0,}};
int Max = 0;
cin >> n >> m;
if( n == 0 && m == 0 ){
break;
}
for(int i = 0; i < n; i++){
cin >> V[i];
}
V[n] = 0;
n++;
sort(V, V + n);
reverse(V, V + n);
for(int i = 0; i < n; i++){
for(int j = 0; j < 4; j++){
D[i][j] = V[i];
if( j > 0 ){
int thisMax = 0;
for(int k = 0; k <= i; k++){
int tmp = D[i][j] + D[k][j - 1];
thisMax = max(thisMax, tmp > m ? 0 : tmp);
}
if( thisMax > D[i][j] ){
D[i][j] = thisMax;
}
}
}
}
for(int i = 0; i < n; i++){
for(int j = 0; j < 4; j++){
//cout << D[i][j] << ' ';
if( D[i][j] <= m ){
if( Max < D[i][j] ){
Max = D[i][j];
}
}
}
//cout << '\n';
}
cout << Max << '\n';
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:17: error: 'cin' was not declared in this scope
15 | cin >> n >> m;
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include<vector>
+++ |+#include <iostream>
3 |
a.cc:58:17: error: 'cout' was not declared in this scope
58 | cout << Max << '\n';
| ^~~~
a.cc:58:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s482203967 | p00452 | C++ | #include<set>
#include<vector>
using namespace std;
typedef unsigned int uint;
uint maxv;
void solve(uint now,uint m,uint *a,int n){
int r=n-1,l=0,mid;
while(l <=r){
mid = (l+r)/2;
if ( a[mid]+now>m)r=mid-1;
else if ( a[mid]+now <m)l=mid+1;
else break;
}
if ( now+a[mid]>maxv&& now+a[mid]<m)maxv=now+a[mid];
}
main(){
int n;
uint m;
while(scanf("%d%d",&n,&m) && n){
set<uint> S;
uint one[n];
uint two[n*n];
int p=0;
for(int i=0;i<n;i++)scanf("%d",&one[i]);
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
if ( S.find(i+j) == S.end())S.insert(i+j),two[p++]=one[i]+one[j];
}
}
sort(one,one+n);
sort(two,two+p);
maxv=0;
for(int i=0;i<p;i++){
if ( two[i]+one[0]>m)break;
if ( two[i]+two[0]<=m)solve(two[i],m,two,p);
if ( two[i]+one[0]<=m)solve(two[i],m,one,n);
}
printf("%d\n",maxv);
}
return false;
} | a.cc:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
19 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:22:9: error: 'scanf' was not declared in this scope
22 | while(scanf("%d%d",&n,&m) && n){
| ^~~~~
a.cc:33:5: error: 'sort' was not declared in this scope; did you mean 'short'?
33 | sort(one,one+n);
| ^~~~
| short
a.cc:41:5: error: 'printf' was not declared in this scope
41 | printf("%d\n",maxv);
| ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
2 | #include<vector>
+++ |+#include <cstdio>
3 | using namespace std;
|
s426263533 | p00452 | C++ | #include<cstdio>
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define reps(i,n) for(int i=1;i<=int(n);i++)
#define f first
#define s second
int main(){
while(1){
int n,m;
cin>>n>>m;
if(n==0)break;
vector<int> ya;
ya.push_back(0);
rep(i,n){
int a;
cin>>a;
ya.push_back(a);
}
vector<int> y2;
rep(i,ya.size()){
rep(j,ya.size()){
y2.push_back(ya[i]+ya[j]);
}
}
sort(y2.begin(),y2.end());
int maxi=0;
rep(i,y2.size()){
int *a = (lower_bound(y2.begin(),y2.end(),(m-y2[i]+1))-1);
maxi= max(maxi,y2[i]+*a);
}
printf("%d\n",maxi);
}
} | a.cc: In function 'int main()':
a.cc:45:79: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int*' in initialization
45 | int *a = (lower_bound(y2.begin(),y2.end(),(m-y2[i]+1))-1);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
| |
| __gnu_cxx::__normal_iterator<int*, std::vector<int> >
|
s460716142 | p00452 | C++ | #include<cstdio>
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define reps(i,n) for(int i=1;i<=int(n);i++)
#define f first
#define s second
int main(){
while(1){
int n,m;
cin>>n>>m;
if(n==0)break;
vector<int> ya;
ya.push_back(0);
rep(i,n){
int a;
cin>>a;
ya.push_back(a);
}
vector<int> y2;
rep(i,ya.size()){
rep(j,ya.size()){
y2.push_back(ya[i]+ya[j]);
}
}
sort(y2.begin(),y2.end());
int maxi=0;
rep(i,y2.size()){
vector<int>::iterator = (lower_bound(y2.begin(),y2.end(),(m-y2[i]+1))-1);
maxi= max(maxi,y2[i]+*a);
}
printf("%d\n",maxi);
}
} | a.cc: In function 'int main()':
a.cc:45:47: error: expected unqualified-id before '=' token
45 | vector<int>::iterator = (lower_bound(y2.begin(),y2.end(),(m-y2[i]+1))-1);
| ^
a.cc:46:47: error: 'a' was not declared in this scope
46 | maxi= max(maxi,y2[i]+*a);
| ^
|
s960447408 | p00452 | C++ | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
using namespace std;
#define sz size()
#define lgt length()
#define rep(i,n) for (int i = 0; i < n; i++)
#define ALL(X) (X).begin(),(X).end()
#define RALL(X) (X).rbegin(),(X).rend()
#define pb push_back
#define SORT(a) sort(ALL(a));
#define RSORT(a) sort(RALL(a));
#define mp make_pair
#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define fir first
#define sec second
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<string> vs;
int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
vs form(string a,char s){vs v;string b;rep(i,a.lgt){if(a[i]==s){v.pb(b);b="";}else b+=a[i];}v.pb(b);return v;}
vi formint(string a,char s){vi v;string b;rep(i,a.lgt){if(a[i]==s){v.pb(toInt(b));b="";}else b+=a[i];}v.pb(toInt(b));return v;}
const double EPS=1e-10,PI=acos(-1.0);
const int INF=2100000000;
int main(void)
{
int n, m, tmp;
while (cin >> n >> m, n && m){
int res = 0;
vi v, v1;
v.pb(0);
for (int i = 0; i < n; i++){
cin >> tmp;
v.pb(tmp);
}
for (int i = 0; i < v.sz; i++){
for (int j = 0; j < v.sz; j++){
v1.pb(v[i] + v[j]);
v2.pb(v[i] + v[j]);
}
}
SORT(v1);
for (int i = 0, j = v1.sz - 1; i < v1.sz && 0 <= j;){
if (m < v1[i] + v1[j]) j--;
else {
res = max(res, v1[i] + v1[j]);
i++;
}
}
cout << res << endl;
v.clear();
}
return 0;
} | a.cc: In function 'int main()':
a.cc:61:33: error: 'v2' was not declared in this scope; did you mean 'v1'?
61 | v2.pb(v[i] + v[j]);
| ^~
| v1
|
s479997157 | p00452 | C++ | #include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
int a,b,mato[1000];
vector<int> nums;
while(scanf("%d%d",&a,&b),a,b){
int res=0;
nums.clear();
for(int i=0;i<a;i++)scanf("%d",mato+i);
for(int i=0;i<=a;i++)
for(int j=0;j<=a;j++)
nums.push_back(mato[i]*!!(i-a)+mato[j]!!(j-a));
sort(nums.begin(),nums.end());
vector<int>::iterator it=nums.begin();
while(it!=nums.end() && b>=*it){
vector<int>::iterator itt=upper_bound(nums.begin(),nums.end(),b-*it);
res=max(res,*it+++*--itt);
}
printf("%d\n",res);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:71: error: expected ')' before '!' token
14 | nums.push_back(mato[i]*!!(i-a)+mato[j]!!(j-a));
| ~ ^
| )
|
s832893302 | p00452 | C++ | #include<iostream>
#include<cstring>
#include<queue>
using namespace std;
vector<long long int> p;
vector<long long int> p2;
int main(void){
int a,b,n,m;
while(1){
long long int ans=0;
scanf("%d%d",&n,&m);
if(n==0 && m==0)break;
p.clear();
p2.clear();
for(a=0;a<n;a++){
int num;
scanf("%d",&num);
p.push_back(num);
}
sort(p.begin(),p.end());
p2.push_back(0);
for(a=0;a<n;a++){
p2.push_back(p[a]);
for(b=0;b<n;b++){
p2.push_back(p[a]+p[b]);
}
}
p2.push_back(0);
sort(p2.begin(),p2.end());
for(a=0;a<p2.size();a++){
long long int res=m-p2[a];
if(m-p2[a]<0)continue;
long long int pp=*(lower_bound(p2.begin(),p2.end(),res)-1);
if(ans<pp+p2[a])ans=pp+p2[a];
//cout << pp+p2[a] << endl;
}
printf("%d\n",ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:22:17: error: 'sort' was not declared in this scope; did you mean 'short'?
22 | sort(p.begin(),p.end());
| ^~~~
| short
|
s212852496 | p00452 | C++ | #include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int n, m;
while(1){
scanf("%d%d", &n, &m);
if(n == 0 && m == 0)return 0;
int res = 0, tmp;
vector<int> points, points2;
for(int i = 0;i < n;i++){
scanf("%d", &tmp);
points.push_back(tmp);
}
set<int>::iterator it1,it2;
for(it1 = points.begin();it1 != points.end();it1++){
for(it2 = points.begin();it2 != points.end();it2++){
points2.push_back(*it1 + *it2);
}
}
sort(points2.begin(),points2.end());
for(it1 = points2.begin();it1 != points2.end();it1++){
it2 = upper_bound(points2.begin(), points2.end(), m - *it1);
if(it2 == points2.begin())continue;
it2--;
res = max(res, *it1 + *it2);
}
printf("%d\n",res);
}
} | a.cc: In function 'int main()':
a.cc:17:5: error: 'set' was not declared in this scope
17 | set<int>::iterator it1,it2;
| ^~~
a.cc:4:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
3 | #include<algorithm>
+++ |+#include <set>
4 | using namespace std;
a.cc:17:9: error: expected primary-expression before 'int'
17 | set<int>::iterator it1,it2;
| ^~~
a.cc:18:9: error: 'it1' was not declared in this scope
18 | for(it1 = points.begin();it1 != points.end();it1++){
| ^~~
a.cc:19:11: error: 'it2' was not declared in this scope
19 | for(it2 = points.begin();it2 != points.end();it2++){
| ^~~
a.cc:24:9: error: 'it1' was not declared in this scope
24 | for(it1 = points2.begin();it1 != points2.end();it1++){
| ^~~
a.cc:25:7: error: 'it2' was not declared in this scope
25 | it2 = upper_bound(points2.begin(), points2.end(), m - *it1);
| ^~~
|
s895480022 | p00452 | C++ | #include <cstdio>
int main()
{
while(true) {
int n, m;
vector<int> x, xxx;
scanf("%d%d", &n, &m);
if(n == 0)
break;
x.resize(i);
for(int i = 0; i < n; ++i)
scanf("%d", &x[i]);
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j)
xxx.push_back(x[i] + x[j]);
}
xxx.push_back(0);
sort(xxx.begin(), xxx.end());
int ans = 0;
for(int i = 0; i < xxx.size(); ++i) {
int r = m - xxx[i];
if(r < 0)
continue;
int idx = upper_bound(xxx.begin(), xxx.end(), r) - xxx.begin() - 1;
if(idx < 0)
continue;
ans = max(ans, r + xxx[idx]);
}
printf("%d\n", ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:1: error: 'vector' was not declared in this scope
7 | vector<int> x, xxx;
| ^~~~~~
a.cc:7:8: error: expected primary-expression before 'int'
7 | vector<int> x, xxx;
| ^~~
a.cc:11:1: error: 'x' was not declared in this scope
11 | x.resize(i);
| ^
a.cc:11:10: error: 'i' was not declared in this scope
11 | x.resize(i);
| ^
a.cc:16:1: error: 'xxx' was not declared in this scope
16 | xxx.push_back(x[i] + x[j]);
| ^~~
a.cc:18:1: error: 'xxx' was not declared in this scope
18 | xxx.push_back(0);
| ^~~
a.cc:19:1: error: 'sort' was not declared in this scope; did you mean 'short'?
19 | sort(xxx.begin(), xxx.end());
| ^~~~
| short
a.cc:25:11: error: 'upper_bound' was not declared in this scope
25 | int idx = upper_bound(xxx.begin(), xxx.end(), r) - xxx.begin() - 1;
| ^~~~~~~~~~~
a.cc:28:7: error: 'max' was not declared in this scope
28 | ans = max(ans, r + xxx[idx]);
| ^~~
|
s443440460 | p00452 | C++ | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
while(true) {
int n, m;
vector<int> x, xxx;
scanf("%d%d", &n, &m);
if(n == 0)
break;
x.resize(i);
for(int i = 0; i < n; ++i)
scanf("%d", &x[i]);
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j)
xxx.push_back(x[i] + x[j]);
}
xxx.push_back(0);
sort(xxx.begin(), xxx.end());
int ans = 0;
for(int i = 0; i < xxx.size(); ++i) {
int r = m - xxx[i];
if(r < 0)
continue;
int idx = upper_bound(xxx.begin(), xxx.end(), r) - xxx.begin() - 1;
if(idx < 0)
continue;
ans = max(ans, r + xxx[idx]);
}
printf("%d\n", ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:10: error: 'i' was not declared in this scope
14 | x.resize(i);
| ^
|
s777675805 | p00452 | C++ | #include<cstdio>
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
int main(void)
{
vector<int>a;
priority_queue<int>ans;
int n,m;
int input;
while(scanf("%d%d",&n,&m),n+m)
{
a.clear();
ans.clear();
a.push_back(0);
for(int i = 0;i < n;i++)
{
scanf("%d",&input);
a.push_back(input);
}
int s = a.size();
int one,two;
for(int i = 0;i < s;i++)
for(int j = 0;j < s;j++)
{
one = a[i],two = a[j];
if(one + two <= m) a.push_back(one + two);
}
s = a.size();
for(int i = 0;i < s;i++)
for(int j = 0;j < s;j++)
{
one = a[i],two = a[j];
if(one+two <= m) ans.push(one+two);
}
cout<<ans.top()<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:19:11: error: 'class std::priority_queue<int>' has no member named 'clear'
19 | ans.clear();
| ^~~~~
|
s584388601 | p00452 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
while(1){
int n,m,p,q=0,r=0,l=0,s=0,e=0,ans=0;
cin>>n>>m;
if(n==0 && m==0)
break;
vector<int> a,x;
a.push_back(0);
for(int i=0;i<n;i++){
cin>>p;
a.push_back(p);
}
q=n+1;
//cout<<q<<endl;
for(int i=0;i<q;i++){
for(int j=0;j<q;j++){
x.push_back(a[i]+a[j]);
}
}
sort(x.begin(),x.end());
//for(int i=0;i<q*q;i++)
//cout<<x[i]<<' ';
//cout<<endl;
for(int i=0;i<x.size();i++){
r=m-x[i];
//cout<<r<<"を探します"<<endl;
if(r>=0){
s=0;
e=q*q;
l=(s+e)/2;
while(s<e){
//cout<<"l="<<l<<endl;
l=(s+e)/2;
if(x[l]==r)break;
if(x[l]>r){
e=l-1;
}else{
s=l+1;
}
}
while(x[l]>r&&p>0)
p--;
while(1){
if(l+1==q*q)break;
if(x[l+1]<=r){l++;
else break;
}
}
}
ans=max(ans,x[i]+x[l]);
}
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:50:33: error: expected '}' before 'else'
50 | else break;
| ^~~~
a.cc:49:46: note: to match this '{'
49 | if(x[l+1]<=r){l++;
| ^
a.cc:54:31: error: 'i' was not declared in this scope
54 | ans=max(ans,x[i]+x[l]);
| ^
a.cc:56:23: error: 'ans' was not declared in this scope; did you mean 'abs'?
56 | cout<<ans<<endl;
| ^~~
| abs
a.cc: At global scope:
a.cc:58:9: error: expected unqualified-id before 'return'
58 | return 0;
| ^~~~~~
a.cc:59:1: error: expected declaration before '}' token
59 | }
| ^
|
s403411321 | p00453 | Java | import java.io.*;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.Collectors;
@SuppressWarnings("unused")
public class Main {
//final boolean isDebug = true;
final boolean isDebug = false;
String fileName = "input.txt";
FastScanner sc;
PrintWriter out;
final int MOD = (int)1e9+7;
//final int INF = Integer.MAX_VALUE / 2;
final long INF = Long.MAX_VALUE / 2;
void solve() throws Exception{
while(true){
int n = sc.nextInt(), m = sc.nextInt();
if(n == 0 && m == 0) break;
calc(n, m);
}
}
void calc(int n, int m){
ArrayList<ArrayList<Pair>> list = new ArrayList<>();
long[][][] cost = new long[n][1000][m+1];
for(int i = 0; i < n; i++){
list.add(new ArrayList<>());
int k = sc.nextInt();
for(int j = 0; j < k; j++){
int x = sc.nextInt(), d = sc.nextInt();
list.get(i).add(new Pair(x, d));
for(int p = 0; p <= m; p++){
if(i == 0 && p == 0) cost[i][j][p] = 0;
else cost[i][j][p] = Long.MAX_VALUE;
}
}
}
for(int i = 0; i < n-1; i++){
for(int j = 0; j < list.get(i).size(); j++){
for(int k = 0; k < list.get(i+1).size(); k++){
for(int p = 0; p <= m; p++){
if(cost[i][j][p] == Long.MAX_VALUE) continue;
long d1 = list.get(i).get(j).d, d2 = list.get(i+1).get(k).d;
int x1 = list.get(i).get(j).x, x2 = list.get(i+1).get(k).x;
long c = (d1 + d2) * Math.abs(x2 - x1);
cost[i+1][k][p] = Math.min(cost[i+1][k][p], cost[i][j][p] + c);
if(i >= n-2 || p == m) continue;
d2 = list.get(i+2).get(k).d;
x2 = list.get(i+2).get(k).x;
c = (d1 + d2) * Math.abs(x2 - x1);
cost[i+2][k][p+1] = Math.min(cost[i+2][k][p+1], cost[i][j][p] + c);
}
}
}
}
long min = Long.MAX_VALUE;
for(int i = 0; i < list.get(n-2).size(); i++){
for(int j = 0; j < m; j++){
min = Math.min(min, cost[n-2][i][j]);
}
}
for(int i = 0; i < list.get(n-1).size(); i++){
for(int j = 0; j <= m; j++){
min = Math.min(min, cost[n-1][i][j]);
}
}
System.out.println(min);
}
/* end solve */
/* main */
public static void main(String[] args) throws Exception {
new Main().m();
}
void m() throws Exception {
long S = System.currentTimeMillis();
sc = (isDebug) ? new FastScanner(new FileInputStream(fileName)) : new FastScanner(System.in);
out = new PrintWriter(System.out);
solve();
out.flush();
long G = System.currentTimeMillis();
if(isDebug){
System.out.println("---Debug---");
System.out.printf("%8d ms\n", (G-S));
}
}
/* end main */
}
/* end Main */
class FastScanner {
private InputStream in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
public FastScanner(InputStream in) {
this.in = in;
}
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
}else{
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() {
if (hasNextByte()) return buffer[ptr++];
else return -1;
}
private static boolean isPrintableChar(int c){
return 33 <= c && c <= 126;
}
public boolean hasNext() {
while(hasNextByte() && !isPrintableChar(buffer[ptr]))
ptr++; return hasNextByte();
}
public String next() {
if (!hasNext()) throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while(isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public String nextLine() {
if (!hasNext()) throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while(b != 10) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext()) throw new NoSuchElementException();
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while(true){
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
}else if(b == -1 || !isPrintableChar(b)){
return minus ? -n : n;
}else{
throw new NumberFormatException();
}
b = readByte();
}
}
public int nextInt() {
long nl = nextLong();
if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
return (int) nl;
}
public double nextDouble() {
return Double.parseDouble(next());
}
}
| Main.java:27: error: cannot find symbol
ArrayList<ArrayList<Pair>> list = new ArrayList<>();
^
symbol: class Pair
location: class Main
Main.java:34: error: cannot find symbol
list.get(i).add(new Pair(x, d));
^
symbol: class Pair
location: class Main
2 errors
|
s509320966 | p00453 | Java | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;
const int INF = 1e+9;
typedef pair<int, int> P;
int memo[151][11][80];
int N, M;
vector<P> G[151];
int rec(int n, int p, int m){
if(memo[n][p][m] != -1)
return memo[n][p][m];
int res = INF;
if(n > N){
return 0;
}
if(n == N){
res = min(res, rec(n + 1, p, m));
}
if(n == N - 1 && m >= 1){
res = min(res, rec(n + 2, p, m - 1));
}
if(n == 0){
for(int i = 0; i < G[0].size(); ++i){
res = min(res, rec(n + 1, i, m));
}
if(m >= 1){
for(int i = 0; i < G[1].size(); ++i){
res = min(res, rec(n + 2, i, m - 1));
}
}
}
else{
for(int i = 0; i < G[n].size(); ++i){
res = min(res, rec(n + 1, i, m) + (G[n - 1][p].second + G[n][i].second) * abs(G[n][i].first - G[n - 1][p].first));
}
if(n != N - 1 && m >= 1){
for(int i = 0; i < G[n + 1].size(); ++i){
res = min(res, rec(n + 2, i, m - 1) + (G[n - 1][p].second + G[n + 1][i].second) * abs(G[n + 1][i].first - G[n - 1][p].first));
}
}
}
return memo[n][p][m] = res;
}
int main() {
while(cin >> N >> M && (N || M)){
memset(memo, -1, sizeof(memo));
for(int i = 0; i <= 150; ++i)
G[i].clear();
int k, d, x;
for(int i = 0; i < N; ++i){
scanf("%d", &k);
for(int j = 0; j < k; ++j){
scanf("%d%d", &d, &x);
G[i].push_back(P(d, x));
}
}
cout << rec(0, 0, M) << endl;
}
return 0;
} | Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:2: error: illegal character: '#'
#include <vector>
^
Main.java:3: error: illegal character: '#'
#include <map>
^
Main.java:4: error: illegal character: '#'
#include <algorithm>
^
Main.java:5: error: illegal character: '#'
#include <cmath>
^
Main.java:6: error: illegal character: '#'
#include <cstring>
^
Main.java:9: error: class, interface, enum, or record expected
const int INF = 1e+9;
^
Main.java:10: error: class, interface, enum, or record expected
typedef pair<int, int> P;
^
Main.java:12: error: class, interface, enum, or record expected
int memo[151][11][80];
^
Main.java:13: error: class, interface, enum, or record expected
int N, M;
^
Main.java:14: error: class, interface, enum, or record expected
vector<P> G[151];
^
Main.java:16: error: unnamed classes are a preview feature and are disabled by default.
int rec(int n, int p, int m){
^
(use --enable-preview to enable unnamed classes)
Main.java:66: error: not a statement
cout << rec(0, 0, M) << endl;
^
Main.java:60: error: illegal start of expression
scanf("%d", &k);
^
Main.java:62: error: illegal start of expression
scanf("%d%d", &d, &x);
^
Main.java:62: error: illegal start of expression
scanf("%d%d", &d, &x);
^
16 errors
|
s994162506 | p00453 | C++ | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#define INF (1000000000)
#define MOD (1000000007)
using namespace std;
typedef vector<int> VI;
typedef vector<int>::iterator VII;
typedef vector<double> VD;
typedef vector<double>::iterator VDI;
typedef vector<long>::iterator VL;
typedef vector<long>::iterator VLI;
typedef pair<int, int> P;
int d[150][1000];
int dp[150][1000][100];
int main()
{
int n, m;
while (scanf("%d %d", &n, &m), n + m){
memset(d, 0, sizeof(d));
int maxx = 0;
for (int i = 0; i < n; i++){
int k;
scanf("%d", &k);
for (int j = 0; j < k; j++){
int x;
scanf("%d", &x);
x--;
scanf("%d", &d[i][x]);
maxx = max(maxx, x);
}
}
for (int i = 0; i < 150; i++){
for (int j = 0; j <= maxx; j++){
for (int k = 0; k < 100; k++){
if (i == 0 && d[i][j] && k == 0) dp[i][j][k] = 0;
else dp[i][j][k] = INF;
}
}
}
for (int i = 0; i < n; i++){
for (int j = 0; j <= maxx; j++){
for (int k = 0; k <= maxx; k++){
for (int l = 0; l <= m; l++){
if (d[i][j] && d[i + 1][k]){
dp[i + 1][k][l] = min(dp[i + 1][k][l], dp[i][j][l] + (d[i][j] + d[i + 1][k]) * abs(j - k));
//printf("%d\n", dp[i + 1][k][l]);
}
if (i < n - 1 && d[i][j] && d[i + 2][k]){
dp[i + 2][k][l + 1] = min(dp[i + 2][k][l + 1], dp[i][j][l] + (d[i][j] + d[i + 2][k]) * abs(j - k));
}
}
}
}
}
int mini = INF;
for (int i = 0; i <= maxx i++){
for (int j = 0; j <= m; j++){
mini = min(mini, dp[n - 1][i][j]);
}
}
printf("%d\n", mini);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:80:42: error: expected ';' before 'i'
80 | for (int i = 0; i <= maxx i++){
| ^~
| ;
|
s651151772 | p00453 | C++ | //Solution for aoj:0530 Pyon-Pyon River Crossing
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
const int INF = 100000000, MAX_N = 150;
typedef pair<int, int> P;
int n, m, ans;
int dp[MAX_N + 20][10010][760];
P stone, stone2;
vector<P> Stone[151]; //first:??????second:???????????????
int main(){
while (cin >> n >> m){
if (!n&&!m)
return 0;
for (int i = 1; i <= n; i++)
Stone[i].clear();
for (int i = 1; i <= n; i++){
int a, b, c;
cin >> c;
for (int j = 0; j < c; j++){
cin >> a >> b;
Stone[i].push_back(P(a, b));
}
}
for (int i = 2; i <= n; i++){
for (int j = 1; j <= 1000; j++){
for (int k = 0; k <= m; k++){
dp[i][j][k] = 0;
}
}
}
for (int i = 0; i < Stone[2].size(); i++){
stone = Stone[2][i];
dp[2][stone.first][m] = INF;
}
for (int i = 3; i <= n; i++){
for (int j = 0; j < Stone[i].size(); j++){
stone = Stone[i][j];
for (int k = 0; k <= m; k++)
dp[i][stone.first][k] = INF;
}
}
for (int i = 1; i < n; i++){
for (int j = 0; j < Stone[i].size(); j++){
stone = Stone[i][j];
for (int k = 0; k < Stone[i + 1].size(); k++){
stone2 = Stone[i + 1][k];
for (int l = m; l >= m - (i + 1) / 2; l--){
if (l < 0)
break;
if (l != m)
dp[i + 1][stone2.first][l] = min(dp[i + 1][stone2.first][l], dp[i + 1][stone2.first][l + 1]);
dp[i + 1][stone2.first][l] = min(dp[i + 1][stone2.first][l], (stone.second + stone2.second)*abs(stone.first - stone2.first) + dp[i][stone.first][l]);
}
}
for (int k = 0; k < Stone[i + 2].size(); k++){
stone2 = Stone[i + 2][k];
for (int l = m - 1; l >= m - (i + 2) / 2; l--){
if (l < 0)
break;
if (l != m)
dp[i + 1][stone2.first][l] = min(dp[i + 2][stone2.first][l], dp[i + 2][stone2.first][l + 1]);
dp[i + 2][stone2.first][l] = min(dp[i + 2][stone2.first][l], (stone.second + stone2.second)*abs(stone.first - stone2.first) + dp[i][stone.first][l + 1]);
}
}
}
}
ans = INF;
for (int i = 0; i < Stone[n].size(); i++){
stone = Stone[n][i];
ans = min(dp[n][stone.first][0], ans);
}
for (int i = 0; i < Stone[n - 1].size(); i++){
if (m == 0)
break;
stone = Stone[n - 1][i];
if (dp[n - 1][stone.first][1])
ans = min(dp[n - 1][stone.first][1], ans);
}
cout << ans << endl;
}
} | /tmp/cc6d0wBG.o: in function `main':
a.cc:(.text+0x4b): relocation truncated to fit: R_X86_64_PC32 against symbol `Stone' defined in .bss section in /tmp/cc6d0wBG.o
a.cc:(.text+0xd2): relocation truncated to fit: R_X86_64_PC32 against symbol `Stone' defined in .bss section in /tmp/cc6d0wBG.o
a.cc:(.text+0x1b4): relocation truncated to fit: R_X86_64_PC32 against symbol `Stone' defined in .bss section in /tmp/cc6d0wBG.o
a.cc:(.text+0x1c6): relocation truncated to fit: R_X86_64_PC32 against symbol `stone' defined in .bss section in /tmp/cc6d0wBG.o
a.cc:(.text+0x1d4): relocation truncated to fit: R_X86_64_PC32 against symbol `stone' defined in .bss section in /tmp/cc6d0wBG.o
a.cc:(.text+0x216): relocation truncated to fit: R_X86_64_PC32 against symbol `Stone' defined in .bss section in /tmp/cc6d0wBG.o
a.cc:(.text+0x25e): relocation truncated to fit: R_X86_64_PC32 against symbol `Stone' defined in .bss section in /tmp/cc6d0wBG.o
a.cc:(.text+0x27b): relocation truncated to fit: R_X86_64_PC32 against symbol `stone' defined in .bss section in /tmp/cc6d0wBG.o
a.cc:(.text+0x292): relocation truncated to fit: R_X86_64_PC32 against symbol `stone' defined in .bss section in /tmp/cc6d0wBG.o
a.cc:(.text+0x2fd): relocation truncated to fit: R_X86_64_PC32 against symbol `Stone' defined in .bss section in /tmp/cc6d0wBG.o
a.cc:(.text+0x35b): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s790685463 | p00453 | C++ | #include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ALL(a) a.begin(),a.end()
#define ZERO(a) memset(a,0,sizeof(a))
#define INF(a) memset(a,1000000000,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define MAX
using namespace std;
int n,m,dp[155][80][11];
vector<int> x[155],d[155];
void solve(){
for(;;){
cin>>n>>m;
if(!n) break;
int kk,xx,dd;
FOR(i,n){
cin>>kk;
FOR(j,kk){
cin>>xx>>dd;
x[i].pb(xx);
d[i].pb(dd);
}
}
INF(dp);
FOR(i,m+1) dp[n-1][i]=0;
for(int i=n-2;i>=0;i--){
FOR(j,m+1){
FOR(k,x[i].size()){
if(i!=n-2&&j){
FOR(l,x[i+2].size()){
dp[i][j][x[i][k]]=min(dp[i][j][x[i][k]],dp[i+2][j-1][x[i+2][l]]+((d[i][k]+d[i+2][l])*abs(x[i][k]-x[i+2][l])));
}
}
FOR(l,x[i+1].size()){
dp[i][j][x[i][k]]=min(dp[i][j][x[i][k]],dp[i+1][j][x[i+1][l]]+((d[i][k]+d[i+1][l])*abs(x[i][k]-x[i+1][l])));
}
}
}
}
int mi=1000000000;
FOR(i,x[0].size()) mi=min(mi,dp[i][m][x[0][i]]);
cout<<mi<<endl;
}
}
int main(){
solve();
return 0;
} | a.cc: In function 'void solve()':
a.cc:32:24: error: incompatible types in assignment of 'int' to 'int [11]'
32 | FOR(i,m+1) dp[n-1][i]=0;
| ~~~~~~~~~~^~
|
s367338124 | p00453 | C++ | #include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ALL(a) a.begin(),a.end()
#define ZERO(a) memset(a,0,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define MAX
using namespace std;
int n,m;
ll dp[155][80][10],INF=1000000000000000LL;
vector<int> x[155],d[155];
void solve(){
for(;;){
cin>>n>>m;
if(!n&&!m) break;
int kk,xx,dd;
FOR(i,n){
cin>>kk;
FOR(j,kk){
cin>>xx>>dd;
x[i+1].pb(xx);
d[i+1].pb(dd);
}
}
FOR(i,155) FOR(j,80) FOR(k,10) dp[i][j][k]=INF;
FOR(i,m+1) FOR(j,x[n].size()) dp[n][i][j]=0LL;
for(int i=n-1;i>0;i--){
FOR(j,m+1){
FOR(k,x[i].size()){
if(j){
if(i==n-1) dp[i][j][k]=0;
else{
FOR(l,x[i+2].size()){
dp[i][j][k]=min(dp[i][j][k],dp[i+2][j-1][l]+(ll)(d[i][k]+d[i+2][l])*abs(x[i][k]-x[i+2][l]));
}
}
}
FOR(l,x[i+1].size()){
dp[i][j][k]=min(dp[i][j][k],dp[i+1][j][l]+(ll)(d[i][k]+d[i+1][l])*abs(x[i][k]-x[i+1][l]));
}
}
}
}
ll mi=INF;
FOR(i,x[1].size()) mi=min(mi,dp[1][m][i]);
if(m) FOR(i,x[2].size()) mi=min(mi,dp[2][m-1][i]);
cout<<mi<<endl;
x.clear(); d.clear();
}
}
int main(){
solve();
return 0;
} | a.cc: In function 'void solve()':
a.cc:54:5: error: request for member 'clear' in 'x', which is of non-class type 'std::vector<int> [155]'
54 | x.clear(); d.clear();
| ^~~~~
a.cc:54:16: error: request for member 'clear' in 'd', which is of non-class type 'std::vector<int> [155]'
54 | x.clear(); d.clear();
| ^~~~~
|
s728681805 | p00453 | C++ | #include <iostream>
#include <vector>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#define MP make_pair
#define INF 1000000000
using namespace std;
int dp[3][11][85];
vector<pair<int,int> > ve[160];
int main(){
int N,M,a,b,c,T,I,O,tmp,cnt,cntt,hog,res;
vector<pair<int,int> >::iterator it,lit;
while(true){
cin>>N>>M;
if(N==0&&M==0) break;
ve[0].clear();
for(int i=1;i<=N;i++){
ve[i].clear();
cin>>a;
for(int j=0;j<a;j++){
cin>>b>>c;
ve[i].push_back(MP(b,c));
}
}
T=0;I=1;O=2;
for(int i=0;i<3;i++){
for(int j=0;j<11;j++){
fill(dp[i][j],dp[i][j]+85,INF);
}
}
for(int i=0;i<11;i++){
ve[0].push_back(MP(i,0));
dp[T][i][0]=0;
}
for(int i=0;i<(int)ve[0].size();i++){
dp[I][i][0]=0;
}
for(int i=2;i<=N;i++){
cnt=0;
for(it=ve[i].begin();it!=ve[i].end();it++){
for(int j=0;j<=min(i/2,M);j++){
cntt=0;
hog=INF;
for(lit=ve[i-1].begin();lit!=ve[i-1].end();lit++){
hog=min(hog,dp[I][cntt][j]+((lit->second)+(it->second))*abs((lit->first)-(it->first)));
cntt++;
}
if(j!=0){
cntt=0;
for(lit=ve[i-2].begin();lit!=ve[i-2].end();lit++){
hog=min(hog,dp[T][cntt][j-1]+((lit->second)+(it->second))*abs((lit->first)-(it->first)));
cntt++;
}
}
dp[O][cnt][j]=hog;
//cout<<i<<" "<<cnt<<" "<<j<<" "<<hog<<endl;//
}
cnt++;
}
tmp=T;
T=I;
I=O;
O=tmp;
}
res=INF;
for(int i=0;i<=M;i++){
for(int j=0;j<(int)ve[N].size();j++){
res=min(res,dp[I][j][i]);
}
}
if(i!=0)for(int i=0;i<M;i++){
for(int j=0;j<(int)ve[N-1].size();j++){
res=min(res,dp[T][j][i]);
}
}
cout<<res<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:76:20: error: 'i' was not declared in this scope
76 | if(i!=0)for(int i=0;i<M;i++){
| ^
|
s263770665 | p00453 | C++ | #include <iostream>
#include <vector>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#define MP make_pair
#define INF 1000000000
using namespace std;
int dp[3][11][85];
vector<pair<int,int> > ve[160];
int main(){
int N,M,a,b,c,T,I,O,tmp,cnt,cntt,hog,res;
vector<pair<int,int> >::iterator it,lit;
while(true){
cin>>N>>M;
if(N==0&&M==0) break;
ve[0].clear();
for(int i=1;i<=N;i++){
ve[i].clear();
cin>>a;
for(int j=0;j<a;j++){
cin>>b>>c;
ve[i].push_back(MP(b,c));
}
}
T=0;I=1;O=2;
for(int i=0;i<3;i++){
for(int j=0;j<11;j++){
fill(dp[i][j],dp[i][j]+85,INF);
}
}
for(int i=0;i<11;i++){
ve[0].push_back(MP(i,0));
dp[T][i][0]=0;
}
for(int i=0;i<(int)ve[1].size();i++){
dp[I][i][0]=0;
}
for(int i=2;i<=N;i++){
cnt=0;
for(it=ve[i].begin();it!=ve[i].end();it++){
for(int j=0;j<=min(i/2,M);j++){
cntt=0;
hog=INF;
for(lit=ve[i-1].begin();lit!=ve[i-1].end();lit++){
hog=min(hog,dp[I][cntt][j]+((lit->second)+(it->second))*abs((lit->first)-(it->first)));
cntt++;
}
if(j!=0){
cntt=0;
for(lit=ve[i-2].begin();lit!=ve[i-2].end();lit++){
hog=min(hog,dp[T][cntt][j-1]+((lit->second)+(it->second))*abs((lit->first)-(it->first)));
cntt++;
}
}
dp[O][cnt][j]=hog;
//cout<<i<<" "<<cnt<<" "<<j<<" "<<hog<<endl;//
}
cnt++;
}
tmp=T;
T=I;
I=O;
O=tmp;
}
res=INF;
for(int i=0;i<=M;i++){
for(int j=0;j<(int)ve[N].size();j++){
res=min(res,dp[I][j][i]);
}
}
if(i!=0)for(int i=0;i<M;i++){
for(int j=0;j<(int)ve[N-1].size();j++){
res=min(res,dp[T][j][i]);
}
}
cout<<res<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:76:20: error: 'i' was not declared in this scope
76 | if(i!=0)for(int i=0;i<M;i++){
| ^
|
s949082197 | p00453 | C++ | #include<bits/stdc++.h>
#define LL long long
#define rep(i,n) for(int i=0;i<n;++i)
#define FOR(i,a,b) for(int i=a;i<=b;++i)
using namespace std;
static const LL INF = 1LL<<61LL;
typedef pair<LL,LL> PLL;
LL N,M;
LL ans;
LL V[160][1010];
//LL mem[160][1001][80];
LL cal(int y,int x,int m){
LL res=INF;
//if(mem[y][x][m]!=-1)return mem[y][x][m];
if(y>=N)return 0;
if(y==0){
FOR(i,1,1000){
if(V[y+1][i]!=INF)
res=cal(y+1,i,m);
}
}
else{
if(V[y][x]!=INF){
FOR(i,1,1000){
if(m>0&&V[y+1][i]!=INF&&V[y+2][i]!=INF){
LL d1=(V[y][x]+V[y+1][i])*abs(x-i);
LL d2=(V[y][x]+V[y+2][i])*abs(x-i);
res=min(cal(y+1,i,m)+d1,min(cal(y+2,i,m-1)+d2,res));
}
else if(V[y+1][i]!=INF&&V[y+2][i]==INF){
LL d1=(V[y][x]+V[y+1][i])*abs(x-i);
res=min(cal(y+1,i,m)+d1,res);
}
else if(V[y+1][i]==INF&&V[y+2][i]!=INF&&m>0){
LL d2=(V[y][x]+V[y+2][i])*abs(x-i);
res=min(cal(y+2,i,m)+d2,res);
}
}
}
}
return res;
}
int main(){
cin>>N>>M;
memset(mem,-1,sizeof(mem));
rep(i,151)rep(j,1001)V[i][j]=INF;
FOR(i,1,N){
LL t;
cin>>t;
rep(j,t){
LL x,k;
cin>>x>>k;
V[i][x]=k;
}
}
ans=cal(0,0,M);
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:48:12: error: 'mem' was not declared in this scope
48 | memset(mem,-1,sizeof(mem));
| ^~~
|
s123148225 | p00453 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> PP;
int main(){
int n,m;
while(cin>>n>>m,n||m){
int dp[200][200];
int i,j,k,x,d,a;
int inf = 1 << 20;
int ans=inf;
vector<PP> v[200];
for(i=0;i<200;i++) v[i].clear();
int c=0;
for(i=0;i<n;i++){
cin >> k;
for(j=0;j<k;j++){
cin >> x >> d;
v[i].push_back(PP(c,P(x,d)));
c++;
}
}
fill(dp[0],dp[199],inf);
for(i=0;i<v[0].size();i++){
dp[v[0][i].first][0]=0;
}
for(i=0;i<n;i++){
for(j=0;j<v[i].size();j++){
for(a=0;a<=m;a++){
if(dp[v[i][j].first][a]==inf) continue;
/*
for(k=0;k<100;k++){
dp[v[i+1][k].first][a]=min(dp[v[i+1][k].first][a],
dp[v[i][j].first][a]
+abs(v[i+1][k].second.first-v[i][j].second.first)
*(v[i+1][k].second.second+v[i][j].second.second));
*/
}
/*
for(k=0;k<v[i+2].size();k++){
dp[v[i+2][k].first][a+1]=min(dp[v[i+2][k].first][a+1],
dp[v[i][j].first][a]
+abs(v[i+2][k].second.first-v[i][j].second.first)
*(v[i+2][k].second.second+v[i][j].second.second));
}
*/
}
}
}
/*
for(i=0;i<v[n-1].size();i++){
for(j=0;j<=m;j++){
ans=min(ans,dp[v[n-1][i].first][j]);
}
}
for(i=0;i<v[n-2].size();i++){
for(j=0;j<=m-1;j++){
ans=min(ans,dp[v[n-2][i].first][j]);
}
}
*/
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:67:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
67 | cout << ans << endl;
| ^~~
| abs
a.cc: At global scope:
a.cc:69:3: error: expected unqualified-id before 'return'
69 | return 0;
| ^~~~~~
a.cc:70:1: error: expected declaration before '}' token
70 | }
| ^
|
s906347205 | p00453 | C++ | #include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#define int long long
using namespace std;
struct isi {
int zahyou, suberi, mincost;
};
int main()
{
int a, b;
while (cin >> a >> b, a | b) {
vector<isi>I[152][78]{};//??????
int c; cin >> c;
for (int d = 0; d < c; d++) {
int e, f; cin >> e >> f;
isi g; g.zahyou = e; g.suberi = f; g.mincost = 0;
I[0][b].push_back(g);
}
for (int e = 1; e < a; e++) {
int f; scanf("%lld", &f);
for (int g = 0; g < f; g++) {
int h, i; scanf("%lld%lld", &h, &i);
for (int j = b; j >= 0; j--) {
int m = 1 << 29;
for (int k = 0; k < I[e-1][j].size(); k++) {
m = min(m, I[e-1][j][k].mincost+(i + I[e - 1][j][k].suberi)*abs(h - I[e - 1][j][k].zahyou));
}
isi n;
n.zahyou = h; n.suberi = i; n.mincost = m;
I[e][j].push_back(n);
if (e >= 2 && j<b) {
int m = 1 << 29;
for (int k = 0; k < I[e - 2][j + 1].size(); k++) {
m = min(m, I[e-2][j+1][k].mincost+(i + I[e - 2][j + 1][k].suberi)*abs(h - I[e - 2][j + 1][k].zahyou));
}
isi n;
n.zahyou = h; n.suberi = i; n.mincost = m;
I[e][j].push_back(n);
}
}
}
}
int S = 1 << 29;
for (int x = 0; x <= b; x++) {
for (int y = 0; y < I[a-1][x].size(); y++) {
S = min(S, I[a-1][x][y].mincost);
}
}
cout << S << endl;
}
} | cc1plus: error: '::main' must return 'int'
|
s489390983 | p00453 | C++ | #include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#define INF LLONG_MAX/3
#define int long long
using namespace std;
struct isi {
int zahyou, suberi, mincost;
};
signed main()
{
int a, b;
while (cin >> a >> b, a | b) {
vector<isi>I[152][78]{};//??????
int c; cin >> c;
for (int d = 0; d < c; d++) {
int e, f; cin >> e >> f;
isi g; g.zahyou = e; g.suberi = f; g.mincost = 0;
I[0][b].push_back(g);
}
for (int e = 1; e < a; e++) {
int f; scanf("%lld", &f);
for (int g = 0; g < f; g++) {
int h, i; scanf("%lld%lld", &h, &i);
for (int j = b; j >= 0; j--) {
int m = INF;
for (int k = 0; k < I[e-1][j].size(); k++) {
m = min(m, I[e-1][j][k].mincost+(i + I[e - 1][j][k].suberi)*abs(h - I[e - 1][j][k].zahyou));
}
isi n;
n.zahyou = h; n.suberi = i; n.mincost = m;
I[e][j].push_back(n);
if (e >= 2 && j<b) {
int m = INF;
for (int k = 0; k < I[e - 2][j + 1].size(); k++) {
m = min(m, I[e-2][j+1][k].mincost+(i + I[e - 2][j + 1][k].suberi)*abs(h - I[e - 2][j + 1][k].zahyou));
}
isi n;
n.zahyou = h; n.suberi = i; n.mincost = m;
I[e][j].push_back(n);
}
}
}
}
int S = INF;
for (int x = 0; x <= b; x++) {
for (int y = 0; y < I[a-1][x].size(); y++) {
S = min(S, I[a-1][x][y].mincost);
}
}
cout << S << endl;
}
} | a.cc: In function 'int main()':
a.cc:5:13: error: 'LLONG_MAX' was not declared in this scope
5 | #define INF LLONG_MAX/3
| ^~~~~~~~~
a.cc:28:49: note: in expansion of macro 'INF'
28 | int m = INF;
| ^~~
a.cc:5:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
4 | #include<algorithm>
+++ |+#include <climits>
5 | #define INF LLONG_MAX/3
a.cc:5:13: error: 'LLONG_MAX' was not declared in this scope
5 | #define INF LLONG_MAX/3
| ^~~~~~~~~
a.cc:47:25: note: in expansion of macro 'INF'
47 | int S = INF;
| ^~~
a.cc:5:13: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
5 | #define INF LLONG_MAX/3
| ^~~~~~~~~
a.cc:47:25: note: in expansion of macro 'INF'
47 | int S = INF;
| ^~~
|
s116103212 | p00453 | C++ | #include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#define int long long
using namespace std;
struct isi {
int zahyou, suberi, mincost;
};
const int INF = LLONG_MAX / 3;
signed main()
{
int a, b;
while (cin >> a >> b, a | b) {
vector<isi>I[152][78]{};//??????
int c; cin >> c;
for (int d = 0; d < c; d++) {
int e, f; cin >> e >> f;
isi g; g.zahyou = e; g.suberi = f; g.mincost = 0;
I[0][b].push_back(g);
}
for (int e = 1; e < a; e++) {
int f; scanf("%lld", &f);
for (int g = 0; g < f; g++) {
int h, i; scanf("%lld%lld", &h, &i);
for (int j = b; j >= 0; j--) {
int m = INF;
for (int k = 0; k < I[e-1][j].size(); k++) {
m = min(m, I[e-1][j][k].mincost+(i + I[e - 1][j][k].suberi)*abs(h - I[e - 1][j][k].zahyou));
}
isi n;
n.zahyou = h; n.suberi = i; n.mincost = m;
I[e][j].push_back(n);
if (e >= 2 && j<b) {
int m = INF;
for (int k = 0; k < I[e - 2][j + 1].size(); k++) {
m = min(m, I[e-2][j+1][k].mincost+(i + I[e - 2][j + 1][k].suberi)*abs(h - I[e - 2][j + 1][k].zahyou));
}
isi n;
n.zahyou = h; n.suberi = i; n.mincost = m;
I[e][j].push_back(n);
}
}
}
}
int S = INF;
for (int x = 0; x <= b; x++) {
for (int y = 0; y < I[a-1][x].size(); y++) {
S = min(S, I[a-1][x][y].mincost);
}
}
cout << S << endl;
}
} | a.cc:11:17: error: 'LLONG_MAX' was not declared in this scope
11 | const int INF = LLONG_MAX / 3;
| ^~~~~~~~~
a.cc:5:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
4 | #include<algorithm>
+++ |+#include <climits>
5 | #define int long long
|
s007442798 | p00453 | C++ | #include<bits/stdc++>h>
#define int long long
using namespace std;
struct isi {
int zahyou, suberi, mincost;
};
const int INF = LLONG_MAX / 3;
signed main()
{
int a, b;
while (cin >> a >> b, a | b) {
vector<isi>I[152][78]{};//??????
int c; cin >> c;
for (int d = 0; d < c; d++) {
int e, f; cin >> e >> f;
isi g; g.zahyou = e; g.suberi = f; g.mincost = 0;
I[0][b].push_back(g);
}
for (int e = 1; e < a; e++) {
int f; scanf("%lld", &f);
for (int g = 0; g < f; g++) {
int h, i; scanf("%lld%lld", &h, &i);
for (int j = b; j >= 0; j--) {
int m = INF;
for (int k = 0; k < I[e-1][j].size(); k++) {
m = min(m, I[e-1][j][k].mincost+(i + I[e - 1][j][k].suberi)*abs(h - I[e - 1][j][k].zahyou));
}
isi n;
n.zahyou = h; n.suberi = i; n.mincost = m;
I[e][j].push_back(n);
if (e >= 2 && j<b) {
int m = INF;
for (int k = 0; k < I[e - 2][j + 1].size(); k++) {
m = min(m, I[e-2][j+1][k].mincost+(i + I[e - 2][j + 1][k].suberi)*abs(h - I[e - 2][j + 1][k].zahyou));
}
isi n;
n.zahyou = h; n.suberi = i; n.mincost = m;
I[e][j].push_back(n);
}
}
}
}
int S = INF;
for (int x = 0; x <= b; x++) {
for (int y = 0; y < I[a-1][x].size(); y++) {
S = min(S, I[a-1][x][y].mincost);
}
}
cout << S << endl;
}
} | a.cc:1:23: warning: extra tokens at end of #include directive
1 | #include<bits/stdc++>h>
| ^
a.cc:1:9: fatal error: bits/stdc++>: No such file or directory
1 | #include<bits/stdc++>h>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s533732628 | p00453 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#define int long long
#define INF INT_MAX
using namespace std;
struct isi {
int zahyou, suberi, mincost;
};
signed main()
{
int a, b;
while (cin >> a >> b, a | b) {
vector<isi>c[150][75];
int d;
cin >> d;
for (int e = 0; e < d; e++) {
isi h; h.mincost = 0;
scanf("%lld%lld", &h.zahyou, &h.suberi);
c[0][b].push_back(h);
}
for (int f = 1; f < a; f++) {
int g; cin >> g;
for (int h = 0; h < g; h++) {
int i, j; scanf("%lld%lld", &i, &j);
for (int k = b; k >= 0; k--) {
int m = INF;
for (int l = 0; l < c[f - 1][k].size(); l++) {
m = min(m, c[f - 1][k][l].mincost + (c[f - 1][k][l].suberi + j)*abs(c[f - 1][k][l].zahyou - i));
}
if (m != INF) {
isi r; r.zahyou = i; r.suberi = j; r.mincost = m;
c[f][k].push_back(r);
}
if (k != b&&f > 1) {
int m = INF;
for (int l = 0; l < c[f - 2][k+1].size(); l++) {
m = min(m, c[f - 2][k+1][l].mincost + (c[f - 2][k+1][l].suberi + j)*abs(c[f - 2][k+1][l].zahyou - i));
}
if (m != INF) {
isi r; r.zahyou = i; r.suberi = j; r.mincost = m;
c[f][k].push_back(r);
}
}
}
}
}
int S = INF;
for (int p = 0; p <= b; p++) {
for (isi q : c[a - 1][p]) {
S = min(S, q.mincost);
}
}
cout << S << endl;
}
} | a.cc: In function 'int main()':
a.cc:7:13: error: 'INT_MAX' was not declared in this scope
7 | #define INF INT_MAX
| ^~~~~~~
a.cc:30:49: note: in expansion of macro 'INF'
30 | int m = INF;
| ^~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
5 | #include<vector>
+++ |+#include <climits>
6 | #define int long long
a.cc:7:13: error: 'INT_MAX' was not declared in this scope
7 | #define INF INT_MAX
| ^~~~~~~
a.cc:51:25: note: in expansion of macro 'INF'
51 | int S = INF;
| ^~~
a.cc:7:13: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
7 | #define INF INT_MAX
| ^~~~~~~
a.cc:51:25: note: in expansion of macro 'INF'
51 | int S = INF;
| ^~~
|
s534574023 | p00453 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#define int long long
#define INF INT_MAX
using namespace std;
struct isi {
int zahyou, suberi, mincost;
};
signed main()
{
int a, b;
while (cin >> a >> b, a | b) {
vector<isi>c[152][78];
int d;
cin >> d;
for (int e = 0; e < d; e++) {
isi h; h.mincost = 0;
scanf("%lld%lld", &h.zahyou, &h.suberi);
c[0][b].push_back(h);
}
for (int f = 1; f < a; f++) {
int g; cin >> g;
for (int h = 0; h < g; h++) {
int i, j; scanf("%lld%lld", &i, &j);
if (f == 1&&b) {
isi o; o.zahyou = i; o.suberi = j; o.mincost = 0;
c[1][b - 1].push_back(o);
}
for (int k = b; k >= 0; k--) {
int m = INF;
for (int l = 0; l < c[f - 1][k].size(); l++) {
m = min(m, c[f - 1][k][l].mincost + (c[f - 1][k][l].suberi + j)*abs(c[f - 1][k][l].zahyou - i));
}
if (m != INF) {
isi r; r.zahyou = i; r.suberi = j; r.mincost = m;
c[f][k].push_back(r);
}
if (k != b&&f > 1) {
int m = INF;
for (int l = 0; l < c[f - 2][k+1].size(); l++) {
m = min(m, c[f - 2][k+1][l].mincost + (c[f - 2][k+1][l].suberi + j)*abs(c[f - 2][k+1][l].zahyou - i));
}
if (m != INF) {
isi r; r.zahyou = i; r.suberi = j; r.mincost = m;
c[f][k].push_back(r);
}
}
}
}
}
int S = INF;
for (int p = 0; p <= b; p++) {
for (isi q : c[a - 1][p]) {
S = min(S, q.mincost);
}
}
for (int p = 1; p <= b; p++) {
for (isi q : c[a - 2][p]) {
S = min(S, q.mincost);
}
}
cout << S << endl;
}
} | a.cc: In function 'int main()':
a.cc:7:13: error: 'INT_MAX' was not declared in this scope
7 | #define INF INT_MAX
| ^~~~~~~
a.cc:34:49: note: in expansion of macro 'INF'
34 | int m = INF;
| ^~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
5 | #include<vector>
+++ |+#include <climits>
6 | #define int long long
a.cc:7:13: error: 'INT_MAX' was not declared in this scope
7 | #define INF INT_MAX
| ^~~~~~~
a.cc:55:25: note: in expansion of macro 'INF'
55 | int S = INF;
| ^~~
a.cc:7:13: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
7 | #define INF INT_MAX
| ^~~~~~~
a.cc:55:25: note: in expansion of macro 'INF'
55 | int S = INF;
| ^~~
|
s117361691 | p00453 | C++ | /*
Be joyful in hope, patient in affliction, faithful in prayer.
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>
#include <vector>
#include <deque>
#include <functional>
#include <iterator>
#include <utility>
#include <bitset>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <cctype>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define FOR(i, a, b) for(int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a) - 1; i >= (b); --i)
#define SZ(x) ((int)x.size())
#define openfile {freopen("inp.txt","rt",stdin);freopen("out.txt","wt",stdout);}
#define debug 0
template <typename T> inline void next_int(T &x) {
x = 0; char c; bool neg = false;
while (!isdigit(c = getchar())) if (c == '-') neg = true;
do x = x*10 + c - 48; while (isdigit(c = getchar()));
if (neg) x = -x;
}
template <typename T> inline void write_int(T x, char last = 0) {
if (x < 0) putchar('-'), x = abs(x);
char tmp[20]; int cnt = 0;
while (x >= 10) tmp[cnt++] = x % 10 + 48, x /= 10;
tmp[cnt] = x + 48;
FORD(i, cnt, 0) putchar(tmp[i]);
if (last) putchar(last);
}
const ll oo = (ll)1e18+7;
int n, m;
ll dp[155][15][80];
int k[155], x[155][25], s[155][25];
int main() {
while(scanf("%d%d", &n, &m) == 2 && n){
static = {};
REP(i, 0, 155) REP(j, 0, 15)REP(k, 0, 80) dp[i][j][k] = oo;
REP(i, 0, n) {
scanf("%d", &k[i]);
REP(j, 0, k[i]) scanf("%d%d", &x[i][j], &s[i][j]);
}
REP(i, 0, k[0]) dp[0][i][0] = 0;
REP(i, 0, k[1]) dp[1][i][1] = 0;
REP(i, 0, n - 1) REP(j, 0, k[i]) {
int cur = x[i][j];
REP(l, 0, k[i + 1]) {
int tmp = x[i + 1][l];
FOR(used, 0, m) dp[i + 1][l][used] = min(dp[i + 1][l][used], dp[i][j][used] + (s[i][j] + s[i + 1][l]) * abs(cur - tmp));
}
if(i + 2 < n) {
REP(l, 0, k[i + 2]) {
int tmp = x[i + 2][l];
REP(used, 0, m) dp[i + 2][l][used + 1] = min(dp[i + 2][l][used + 1], dp[i][j][used] + (s[i][j] + s[i + 2][l]) * abs(cur - tmp));
}
}
}
ll ans = oo;
REP(i, 0, k[n - 1]) REP(j, 0, m + 1) ans = min(ans, dp[n - 1][i][j]);
REP(i, 0, k[n - 2]) REP(j, 0, m) ans = min(ans, dp[n - 2][i][j]);
printf("%lld\n", ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:66:25: error: expected unqualified-id before '=' token
66 | static = {};
| ^
|
s683676021 | p00453 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 10000000;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;
#define int long long
#define addm(X, Y) ((X) = ((X) + (Y) % mod) % mod)
int n, m;
ll dp[155][80][1005];
signed main(){
cin.tie(0);
ios::sync_with_stdio(false);
while (true) {
cin >> n >> m;
if (n == 0 && m == 0) break;
vector<vector<pair<int, int>>> st(155);
rep(i, n) {
int k;
cin >> k;
rep(j, k) {
int x, d;
cin >> x >> d;
x--;
st[i].push_back({x, d});
}
}
rep(i, 155)rep(j, 80)rep(k, 1005) dp[i][j][k] = LLONG_MAX / 2;
for (auto p : st[0]) {
dp[0][0][p.fi] = 0;
}
if (m != 0) {
for (auto p : st[1]) {
dp[1][1][p.fi] = 0;
}
}
rep(i, n)rep(j, m + 1) {
for (auto now : st[i]) {
if (dp[i][j][now.fi] == LLONG_MAX / 2) continue;
if (i + 1 >= n) continue;
for (auto nx : st[i + 1]) {
dp[i + 1][j][nx.fi] = min(dp[i + 1][j][nx.fi], dp[i][j][now.fi] + abs(now.fi - nx.fi) * (now.se + nx.se));
}
if (i + 2 >= n || j + 1 > m) continue;
for (auto nx : st[i + 2]) {
dp[i + 2][j + 1][nx.fi] = min(dp[i + 2][j + 1][nx.fi], dp[i][j][now.fi] + abs(now.fi - nx.fi) * (now.se + nx.se));
}
}
}
rep(j, m + 1)rep(k, 1001) ans = min(ans, dp[n - 1][j][k]);
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:85:35: error: 'ans' was not declared in this scope; did you mean 'abs'?
85 | rep(j, m + 1)rep(k, 1001) ans = min(ans, dp[n - 1][j][k]);
| ^~~
| abs
a.cc:86:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
86 | cout << ans << endl;
| ^~~
| abs
|
s835983751 | p00453 | C++ | #include"stdafx.h"
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <vector>
typedef long long int ll;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EREP(i, n) for (int i = (n - 1); i >= 0; --i)
#define mod 1000000007
#define INF 93193111451418101
#define MIN -933111451418101
using namespace std;
typedef pair<ll, ll> P;
template <typename T, typename U>
typename std::enable_if<std::rank<T>::value == 0>::type fill_all(T &arr,
const U &v) {
arr = v;
}
template <typename ARR, typename U>
typename std::enable_if<std::rank<ARR>::value != 0>::type fill_all(ARR &arr,
const U &v) {
for (auto &i : arr) {
fill_all(i, v);
}
}
//------------------??????°-----------------------//
//-------------------???¢???°----------------------//
int main() {
while (1) {
ll n, m;
std::vector<P> rock[1000];
ll dp[155][100][30]; // n???????????¨??°???????????°?????´???
cin >> n >> m;
if (n + m == 0) { break; }
REP(i, n) {
ll k;
cin >> k;
REP(j, k) {
ll place, sliplevel;
cin >> place >> sliplevel;
rock[i + 1].push_back(P(place, sliplevel));
}
}
rock[0].push_back(P(0, 0));
rock[n + 1].push_back(P(0, 0));
fill_all(dp, INF);
dp[0][0][0] = 0;
REP(i, n + 1) { // 0???????????????n+1????????????
REP(j, m + 1) { //????????¨??°?????????
REP(k, (unsigned)rock[i].size()) {
if (dp[i][j][k] == INF) {
continue;
}
if (i == 0 || i == n) {
REP(l, (unsigned)rock[i + 1].size()) {
dp[i + 1][j][l] = min(dp[i + 1][j][l], dp[i][j][k]);
}
if (j < m) {
REP(l, (unsigned)rock[i + 2].size()) {
dp[i + 2][j + 1][l] = min(dp[i + 2][j + 1][l], dp[i][j][k]);
}
}
}
else {
REP(l, (unsigned)rock[i + 1].size()) {
dp[i + 1][j][l] =
min(dp[i + 1][j][l],
dp[i][j][k] +
(rock[i + 1][l].second + rock[i][k].second) *
(abs(rock[i + 1][l].first - rock[i][k].first)));
}
if (j < m) {
REP(l, (unsigned)rock[i + 2].size()) {
dp[i + 2][j + 1][l] = min(dp[i + 2][j + 1][l], dp[i][j][k] + (rock[i + 2][l].second + rock[i][k].second) *(abs(rock[i + 2][l].first - rock[i][k].first)));
}
}
}
}
}
}
ll ans = INF;
REP(j, m + 1) {
ans = min(ans, dp[n + 1][j][0]);
}
cout << ans << endl;
}
} | a.cc:1:9: fatal error: stdafx.h: No such file or directory
1 | #include"stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s802074699 | p00453 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<math.h>
#define INF 1<<30
using namespace std;
int main() {
int row, jump;
int dp[151][11][76];
int val[151][11];
int Size[151];
int num[151][11];
while (cin >> row >> jump, row)
{
for (int i = 0; i < row; i++) {
cin >> Size[i];
for (int j = 0; j < Size[i]; j++) {
cin >> num[i][j] >> val[i][j];
}
}
memset(dp, 0x7f, sizeof(dp)); //初期化
for (int i = 0; i < Size[0]; i++) //岸からのジャンプ
dp[0][i][0] = 0;
for (int i = 0; i < Size[1]; i++)
dp[1][i][1] = 0;
for (int i = 0; i < row-1; i++) {
for (int j = 0; j < Size[i]; j++) {
for (int k = 0; k < Size[i + 1]; k++) {
int risk = (val[i][j] + val[i + 1][k])*abs(num[i][j] - num[i+1][k]);
for (int m = 0; m <= jump; m++)
dp[i + 1][k][m] = min(dp[i + 1][k][m], dp[i][j][m] + risk);
}
if (i == row - 2)continue;
for (int k = 0; k < Size[i + 2]; k++) {
int risk = (val[i][j] + val[i + 2][k])*abs(num[i][j] - num[i + 2][k]);
for (int m = 0; m < jump; m++)
dp[i + 2][k][m+1] = min(dp[i + 2][k][m+1], dp[i][j][m] + risk);
}
}
}
int Min = 0x7f7f7f7f;
for (int i = 0; i < Size[row - 1]; i++)
for (int j = 0; j <= jump; j++) {
Min = min(Min, dp[row - 1][i][j]);
}
for (int i = 0; i < Size[row - 2]; i++)
for (int j = 0; j < jump; j++)
Min = min(Min, dp[row - 2][i][j]);
cout << Min << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:17: error: 'memset' was not declared in this scope
24 | memset(dp, 0x7f, sizeof(dp)); //初期化
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<math.h>
+++ |+#include <cstring>
5 | #define INF 1<<30
|
s533696594 | p00453 | C++ | #include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
#define REP(i,a,b) for(i=a; i<b; ++i)
#define rep(i,n) REP(i,0,n)
int numstone[151];
pair<int,int> stones[151][11];
int memo[151][151][11]; //memo[ツ甘敖つゥツづァツづ個仰猟猟」][ツ氾イツづ篠つオツ氾イツづ堕づーツつオツつスツ嘉アツ青脳[ツ債。ツづ個暗環置]
int n,m;
int solve(int i,int j,int k) {
if(memo[i][j][k] != -1) return memo[i][j][k];
if(i >= n-1) return 0;
int l,ret = 1<<29;
if(j < m) {
rep(l,numstone[i+2]) {
int cc = stones[i][k].second+stones[i+2][l].second;
ret = min(ret, solve(i+2, j+1, l)
+ cc*abs(stones[i][k].first-stones[i+2][l].first));
}
}
rep(l, numstone[i+1]) {
int cc = stones[i][k].second+stones[i+1][l].second;
ret = min(ret, solve(i+1, j, l)
+ cc*abs(stones[i][k].first-stones[i+1][l].first));
}
//printf("row: %d double: %d nowpos: %d ret: %d\n", i,j,k,ret);
return memo[i][j][k] = ret;
}
int main() {
int k,i,j;
while(scanf("%d%d", &n, &m), n|m) {
memset(memo, -1, sizeof(memo));
rep(i,151) rep(j,151) rep(k,11) memo[i][j][k] = -1;
rep(i,n) {
scanf("%d", &k);
numstone[i] = k;
rep(j,k) {
pair<int,int> p;
scanf("%d%d", &(p.first), &(p.second));
stones[i][j] = p;
}
}
int ans = 1<<29;
rep(i, numstone[0]) {
ans = min(ans, solve(0,0,i));
}
printf("%d\n",ans);
}
} | a.cc: In function 'int main()':
a.cc:38:9: error: 'scanf' was not declared in this scope
38 | while(scanf("%d%d", &n, &m), n|m) {
| ^~~~~
a.cc:56:5: error: 'printf' was not declared in this scope
56 | printf("%d\n",ans);
| ^~~~~~
a.cc:4:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
3 | #include<algorithm>
+++ |+#include <cstdio>
4 | using namespace std;
|
s922751065 | p00453 | C++ | #include <stdio.h>
#include <stdlib.h>
#define INF (1000000000)
int dp[151][10][77];
typedef struct {
int slip;
int coor;
} ST;
int main(void)
{
int n, m;
int k[151];
ST st[151][10];
int ans;
k[150] = 0;
for (int i = 0; i < 151; i++){
for (int j = 0; j < 10; j++){
for (int l = 0; l < 77; l++){
dp[i][j][l] = INF;
}
}
}
scanf("%d %d", &n, &m);
for (int i = 0; i < n; i++){
scanf("%d", &k[i]);
for (int j = 0; j < k[i]; j++){
scanf("%d%d", &st[i][j].coor, &st[i][j].slip);
}
}
for (int i = 0; i < k[0]; i++){
dp[0][i][0] = 0;
}
for (int i = 0; i < k[1]; i++){
dp[1][i][1] = 0;
}
for (int i = 0; i < n - 1; i++){
for (int j = 0; j < k[i]; j++){
for (int l = 0; l <= m; l++){
for (int h = 0; h < k[i + 1]; h++){
dp[i + 1][h][l] = min(dp[i + 1][h][l], dp[i][j][l] + ((st[i][j].slip + st[i + 1][h].slip) * abs(st[i][j].coor - st[i + 1][h].coor)));
}
for (int h = 0; h < k[i + 2]; h++){
dp[i + 2][h][l + 1] = min(dp[i + 2][h][l + 1], dp[i][j][l] + (st[i][j].slip + st[i + 2][h].slip) * abs(st[i][j].coor - st[i + 2][h].coor));
}
}
}
}
ans = INF;
for (int i = 0; i < k[n - 1]; i++){
for (int j = 0; j <= m; j++){
ans = min(ans, dp[n - 1][i][j]);
}
}
for (int i = 0; i < k[n - 2]; i++){
for (int j = 0; j < m; j++){
ans = min(ans, dp[n - 2][i][j]);
}
}
printf("%d\n", ans);
return (0);
} | a.cc: In function 'int main()':
a.cc:49:59: error: 'min' was not declared in this scope; did you mean 'main'?
49 | dp[i + 1][h][l] = min(dp[i + 1][h][l], dp[i][j][l] + ((st[i][j].slip + st[i + 1][h].slip) * abs(st[i][j].coor - st[i + 1][h].coor)));
| ^~~
| main
a.cc:52:63: error: 'min' was not declared in this scope; did you mean 'main'?
52 | dp[i + 2][h][l + 1] = min(dp[i + 2][h][l + 1], dp[i][j][l] + (st[i][j].slip + st[i + 2][h].slip) * abs(st[i][j].coor - st[i + 2][h].coor));
| ^~~
| main
a.cc:61:31: error: 'min' was not declared in this scope; did you mean 'main'?
61 | ans = min(ans, dp[n - 1][i][j]);
| ^~~
| main
a.cc:66:31: error: 'min' was not declared in this scope; did you mean 'main'?
66 | ans = min(ans, dp[n - 2][i][j]);
| ^~~
| main
|
s793565406 | p00453 | C++ | #include <stdio.h>
#include <stdlib.h>
#include <algorighm>
using namespace std;
#define INF (1000000000)
int dp[151][10][77];
typedef struct {
int slip;
int coor;
} ST;
int main(void)
{
int n, m;
int k[151];
ST st[151][10];
int ans;
k[150] = 0;
for (int i = 0; i < 151; i++){
for (int j = 0; j < 10; j++){
for (int l = 0; l < 77; l++){
dp[i][j][l] = INF;
}
}
}
scanf("%d %d", &n, &m);
for (int i = 0; i < n; i++){
scanf("%d", &k[i]);
for (int j = 0; j < k[i]; j++){
scanf("%d%d", &st[i][j].coor, &st[i][j].slip);
}
}
for (int i = 0; i < k[0]; i++){
dp[0][i][0] = 0;
}
for (int i = 0; i < k[1]; i++){
dp[1][i][1] = 0;
}
for (int i = 0; i < n - 1; i++){
for (int j = 0; j < k[i]; j++){
for (int l = 0; l <= m; l++){
for (int h = 0; h < k[i + 1]; h++){
dp[i + 1][h][l] = min(dp[i + 1][h][l], dp[i][j][l] + ((st[i][j].slip + st[i + 1][h].slip) * abs(st[i][j].coor - st[i + 1][h].coor)));
}
for (int h = 0; h < k[i + 2]; h++){
dp[i + 2][h][l + 1] = min(dp[i + 2][h][l + 1], dp[i][j][l] + (st[i][j].slip + st[i + 2][h].slip) * abs(st[i][j].coor - st[i + 2][h].coor));
}
}
}
}
ans = INF;
for (int i = 0; i < k[n - 1]; i++){
for (int j = 0; j <= m; j++){
ans = min(ans, dp[n - 1][i][j]);
}
}
for (int i = 0; i < k[n - 2]; i++){
for (int j = 0; j < m; j++){
ans = min(ans, dp[n - 2][i][j]);
}
}
printf("%d\n", ans);
return (0);
} | a.cc:3:10: fatal error: algorighm: No such file or directory
3 | #include <algorighm>
| ^~~~~~~~~~~
compilation terminated.
|
s519561518 | p00453 | C++ | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <bitset>
#include <fstream>
#include <cmath>
#include <ctime>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define REP(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define MSG(a) cout << #a << " " << a << endl;
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
const int INF = 1 << 30;
const int MAX_X = 1005;
unsigned int dp[6][MAX_X][80];
int main()
{
int n, m;
while(cin >> n >> m && n)
{
rep(x,MAX_X) rep(y,6) rep(d,m+1) dp[y%6][x][d] = INF;
vector<vint> r(MAX_X, vint(n+10));
rep(i,MAX_X)rep(j,n) r[i][j]=0;
rep(i,n)
{
int s;
cin >> s;
rep(j,s)
{
int x, d;
cin >> x >> d;
r[x][i] = d;
}
}
rep(x,MAX_X)if(r[x][0]) dp[0][x][m] = 0;
rep(x,MAX_X)if(r[x][1]) dp[1][x][m-1] = 0;
for(int y = 1; y < n; y++)
{
memcpy(dp[y%5], dp[5], sizeof(dp[y%5]));
for(int x = 0; x < MAX_X; x++)
{
if(r[x][y])
{
// ツ津環湘ュツジツδδδ督プ
rep(nx, MAX_X) rep(d, m+1)
if(dp[(y-1)%5][nx][d] != INF)
chmin(dp[y%5][x][d], dp[(y-1)%5][nx][d] + (r[x][y] + r[nx][y-1]) * abs(x - nx));
// ツ暗ェツ段ツづづ篠つオ
if(1 < y)
rep(nx, MAX_X) REP(d, 1, m+1)
if(dp[(y-2)%5][nx][d] != INF)
chmin(dp[y%5][x][d-1], dp[(y-2)%5][nx][d] + (r[x][y] + r[nx][y-2]) * abs(x - nx));
}
}
}
unsigned int res = INF;
rep(x, MAX_X) rep(d, m+1) chmin(res, dp[(n-1)%5][x][d]);
rep(x, MAX_X) REP(d, 1, m+1) chmin(res, dp[(n-2)%5][x][d]);
cout << res << endl;
}
} | a.cc: In function 'int main()':
a.cc:53:17: error: 'memcpy' was not declared in this scope
53 | memcpy(dp[y%5], dp[5], sizeof(dp[y%5]));
| ^~~~~~
a.cc:13:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
12 | #include <ctime>
+++ |+#include <cstring>
13 | using namespace std;
|
s561963169 | p00453 | C++ | #include <iostream>
#include <cstdlib>
using namespace std;
const int INF = (1<<29);
int main(){
int n,m;
while(cin >> n >> m && (n || m)){
int dp[150][10][80], a[150][10], x[150][10];
for(int i=0;i<150;i++){
for(int j=0;j<10;j++){
for(int k=0;k<80;k++) dp[i][j][k] = INF;
a[i][j] = INF;
}
}
for(int i=0;i<n;i++){
int k;
cin >> k;
for(int j=0;j<k;j++){
int b,c;
cin >> b >> c;
x[i][j] = b;
a[i][j] = c;
}
}
for(int i=0;i<10;i++) dp[0][i][0] = 0;
for(int i=0;i<n-1;i++){
for(int l=0;l<=m;l++){
for(int j=0;j<10;j++){
if(a[i][j] == INF) continue;
for(int k=0;k<10;k++){
if(a[i+1][k] == INF) continue;
dp[i+1][k][l] = min(dp[i+1][k][l],dp[i][j][l] + (a[i][j] + a[i+1][k]) * (abs(x[i+1][k]-x[i][j])));
}
if(i < n - 2 && l != m){
for(int k=0;k<10;k++){
if(a[i+2][k] == INF) continue;
dp[i+2][k][l+1] = min(dp[i+2][k][l+1],dp[i][j][l] + (a[i][j] + a[i+2][k]) * (abs(x[i+2][k]-x[i][j])));
}
}
}
}
}
int ans = INF;
for(int j=0;j<=m;j++) for(int k=0;k<10;k++) ans = min(ans,dp[n-1][k][j]);
for(int j=0;j<m;j++) for(int k=0;k<10;k++) ans = min(ans,dp[n-2][k][j])
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:48:76: error: expected ';' before 'cout'
48 | for(int j=0;j<m;j++) for(int k=0;k<10;k++) ans = min(ans,dp[n-2][k][j])
| ^
| ;
49 |
50 | cout << ans << endl;
| ~~~~
|
s873265045 | p00453 | C++ | #import<iostream>
#import<vector>
#import<cstdlib>
int n,m,k,x,d,h,i,j,D[158][151][10];for(;cin>>n>>m,n;cout<<x<<endl){vector<pair<int,int> >S[151];for(i=0;i++<n;)for(cin>>k;k--;S[i].push_back(make_pair(x,d)))cin>>x>>d;fill(**D,*D[158],x=1e9);for(i=S[1].size();i--;)D[m][1][i]=0;for(i=S[2].size();i--;)D[m-1][2][i]=0;for(h=1;h++<n;)for(i=m;~i;i--)for(j=S[h].size();j--;){for(k=S[h-1].size();k--;)D[i][h][j]=min(D[i][h][j],D[i][h-1][k]+(S[h][j].second+S[h-1][k].second)*abs(S[h][j].first-S[h-1][k].first));for(k=S[h-2].size();k--;)D[i][h][j]=min(D[i][h][j],D[i+1][h-2][k]+(S[h][j].second+S[h-2][k].second)*abs(S[h][j].first-S[h-2][k].first));}for(i=m;~i;i--)for(j=S[n].size();j--;)x=min(x,D[i][n][j]);for(i=m;i;i--)for(j=S[n-1].size();j--;)x=min(x,D[i][n-1][j]);}} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<iostream>
| ^~~~~~
a.cc:2:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
2 | #import<vector>
| ^~~~~~
a.cc:3:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
3 | #import<cstdlib>
| ^~~~~~
a.cc:4:37: error: expected unqualified-id before 'for'
4 | int n,m,k,x,d,h,i,j,D[158][151][10];for(;cin>>n>>m,n;cout<<x<<endl){vector<pair<int,int> >S[151];for(i=0;i++<n;)for(cin>>k;k--;S[i].push_back(make_pair(x,d)))cin>>x>>d;fill(**D,*D[158],x=1e9);for(i=S[1].size();i--;)D[m][1][i]=0;for(i=S[2].size();i--;)D[m-1][2][i]=0;for(h=1;h++<n;)for(i=m;~i;i--)for(j=S[h].size();j--;){for(k=S[h-1].size();k--;)D[i][h][j]=min(D[i][h][j],D[i][h-1][k]+(S[h][j].second+S[h-1][k].second)*abs(S[h][j].first-S[h-1][k].first));for(k=S[h-2].size();k--;)D[i][h][j]=min(D[i][h][j],D[i+1][h-2][k]+(S[h][j].second+S[h-2][k].second)*abs(S[h][j].first-S[h-2][k].first));}for(i=m;~i;i--)for(j=S[n].size();j--;)x=min(x,D[i][n][j]);for(i=m;i;i--)for(j=S[n-1].size();j--;)x=min(x,D[i][n-1][j]);}}
| ^~~
a.cc:4:42: error: 'cin' does not name a type
4 | int n,m,k,x,d,h,i,j,D[158][151][10];for(;cin>>n>>m,n;cout<<x<<endl){vector<pair<int,int> >S[151];for(i=0;i++<n;)for(cin>>k;k--;S[i].push_back(make_pair(x,d)))cin>>x>>d;fill(**D,*D[158],x=1e9);for(i=S[1].size();i--;)D[m][1][i]=0;for(i=S[2].size();i--;)D[m-1][2][i]=0;for(h=1;h++<n;)for(i=m;~i;i--)for(j=S[h].size();j--;){for(k=S[h-1].size();k--;)D[i][h][j]=min(D[i][h][j],D[i][h-1][k]+(S[h][j].second+S[h-1][k].second)*abs(S[h][j].first-S[h-1][k].first));for(k=S[h-2].size();k--;)D[i][h][j]=min(D[i][h][j],D[i+1][h-2][k]+(S[h][j].second+S[h-2][k].second)*abs(S[h][j].first-S[h-2][k].first));}for(i=m;~i;i--)for(j=S[n].size();j--;)x=min(x,D[i][n][j]);for(i=m;i;i--)for(j=S[n-1].size();j--;)x=min(x,D[i][n-1][j]);}}
| ^~~
a.cc:4:54: error: 'cout' does not name a type
4 | int n,m,k,x,d,h,i,j,D[158][151][10];for(;cin>>n>>m,n;cout<<x<<endl){vector<pair<int,int> >S[151];for(i=0;i++<n;)for(cin>>k;k--;S[i].push_back(make_pair(x,d)))cin>>x>>d;fill(**D,*D[158],x=1e9);for(i=S[1].size();i--;)D[m][1][i]=0;for(i=S[2].size();i--;)D[m-1][2][i]=0;for(h=1;h++<n;)for(i=m;~i;i--)for(j=S[h].size();j--;){for(k=S[h-1].size();k--;)D[i][h][j]=min(D[i][h][j],D[i][h-1][k]+(S[h][j].second+S[h-1][k].second)*abs(S[h][j].first-S[h-1][k].first));for(k=S[h-2].size();k--;)D[i][h][j]=min(D[i][h][j],D[i+1][h-2][k]+(S[h][j].second+S[h-2][k].second)*abs(S[h][j].first-S[h-2][k].first));}for(i=m;~i;i--)for(j=S[n].size();j--;)x=min(x,D[i][n][j]);for(i=m;i;i--)for(j=S[n-1].size();j--;)x=min(x,D[i][n-1][j]);}}
| ^~~~
a.cc:4:712: error: expected declaration before '}' token
4 | int n,m,k,x,d,h,i,j,D[158][151][10];for(;cin>>n>>m,n;cout<<x<<endl){vector<pair<int,int> >S[151];for(i=0;i++<n;)for(cin>>k;k--;S[i].push_back(make_pair(x,d)))cin>>x>>d;fill(**D,*D[158],x=1e9);for(i=S[1].size();i--;)D[m][1][i]=0;for(i=S[2].size();i--;)D[m-1][2][i]=0;for(h=1;h++<n;)for(i=m;~i;i--)for(j=S[h].size();j--;){for(k=S[h-1].size();k--;)D[i][h][j]=min(D[i][h][j],D[i][h-1][k]+(S[h][j].second+S[h-1][k].second)*abs(S[h][j].first-S[h-1][k].first));for(k=S[h-2].size();k--;)D[i][h][j]=min(D[i][h][j],D[i+1][h-2][k]+(S[h][j].second+S[h-2][k].second)*abs(S[h][j].first-S[h-2][k].first));}for(i=m;~i;i--)for(j=S[n].size();j--;)x=min(x,D[i][n][j]);for(i=m;i;i--)for(j=S[n-1].size();j--;)x=min(x,D[i][n-1][j]);}}
| ^
|
s112891455 | p00453 | C++ | #include<cstdio>
#include<cstring>
#include<vector>
#include<map>
#include<algorithm>
#define INF (1 << 25)
using namespace std;
int main(){
int n, m, tmp;
while(1){
scanf("%d%d", &n, &m);
if(n == 0 && m == 0)return 0;
int dp[3][10][100];
memset(dp, 0, sizeof(dp));
vector< pair<int, int> >stones[n];
for(int i = 0;i < n;i++){
int k, l, m;
scanf("%d", &k);
for(int j = 0;j < k;j++){
scanf("%d %d", &l, &m);
stones[i].push_back(make_pair(l, m));
}
}
for(int i = 0;i < n;i++){
int ind = i%3, prev = (i - 1) % 3, prepre = (i - 2) % 3;
for(int j = 0;j < stones[i].size();j++)
for(int k = 0;k <= m;k++)
dp[ind][j][k] = INF;
for(int j = 0;j < stones[i].size();j++){
if(i == 0)dp[ind][j][m] = 0;
else if(i == 1 && m - 1 >= 0)dp[ind][j][m - 1] = 0;
}
for(int j = 0;j < stones[i].size();j++){
for(int k = 0;k <= m;k++){
for(int l = 0;i > 0 && l < stones[i - 1].size();l++){
dp[ind][j][k] = min(dp[ind][j][k],
dp[prev][l][k] + abs(stones[i - 1][l].first - stones[i][j].first) * (stones[i - 1][l].second + stones[i][j].second));
}
for(int l = 0;i > 1 && k < m && l < stones[i - 2].size();l++){
dp[ind][j][k] = min(dp[ind][j][k],
dp[prepre][l][k + 1] + abs(stones[i - 2][l].first - stones[i][j].first) * (stones[i - 2][l].second + stones[i][j].second));
}
}
}
}
int res = INF;
for(int i = 0;i < stones[n - 1].size();i++){
for(int j = 0;j <= m;j++){
res = min(res, dp[(n - 1) % 3][i][j]);
}
}
if(n - 2 >= 0){
for(int i = 0;i < stones[n - 2].size();i++){
for(int j = 1;j <= m;j++){
res = min(res,dp[(n - 2) % 3][i][j];
}
}
}
printf("%d\n", res);
}
} | a.cc: In function 'int main()':
a.cc:58:46: error: expected ')' before ';' token
58 | res = min(res,dp[(n - 2) % 3][i][j];
| ~ ^
| )
|
s997011204 | p00453 | C++ | #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
using namespace std;
int n,m;
int a,b;
int fie[210][4]; // 行、マス
int dp[210][210][4];// x回目1こ飛ばし、行、マス
void calc(int u)
{
u *= 2;
u++;
for(int i = u-1; i <= n; i++){
for(int j = 0; j < 4; j++){ // 現在の立ち位置
for(int k = 0; k < 4; k++){ // 次の場所
for(int add = 0; add <= 1; add++){
if(add+((u/2) > m)
break;
if(fie[i][j] >= 0 && fie[i+1+add][k] >= 0){
int nowRisk = (fie[i][j] + fie[i+1+add][k])*abs(j-k)+dp[u/2][i][j];
if(dp[u/2][i][j] == -1)
nowRisk += 1;
// cout << nowRisk << endl ;
if(dp[u/2+add][i+1+add][k] >= 0)
dp[u/2+add][i+1+add][k] = min(dp[u/2+add][i+1+add][k], nowRisk);
else
dp[u/2+add][i+1+add][k] = nowRisk;
}
}
}
}
}
}
void solve()
{
int ans = (1 << 25);
for(int i = 1; i <= n; i++){
cin >> a;
for(int j = 0; j < a; j++){
cin >> b;
b--;
cin >> fie[i][b];
}
}
for(int i = 0; i <= m; i++){
calc(i);
for(int j = 0; j < 4; j++){
if(dp[i][n+1][j] >= 0)
ans = min(ans,dp[i][n+1][j]);
if(dp[i][n+2][j] >= 0)
ans = min(ans,dp[i][n+2][j]);
}
}
/* for(int i = 0; i <= n; i++){
for(int j = 0; j < 4; j++){
cout << dp[0][i][j] << ' ';
}
cout << endl;
}
*/
cout << ans << endl;
}
int main(void)
{
while(cin >> n >> m, n | m){
fill(fie[1], fie[1]+(200-1)*4, -1);
fill(dp[0][0], dp[0][0] + 200*200*4, -1);
for(int i = 0; i < 4; i++)
fie[n+1][i] = 0;
solve();
}
} | a.cc: In function 'void calc(int)':
a.cc:20:59: error: expected ';' before 'break'
20 | if(add+((u/2) > m)
| ^
| ;
21 | break;
| ~~~~~
a.cc:22:41: error: expected primary-expression before 'if'
22 | if(fie[i][j] >= 0 && fie[i+1+add][k] >= 0){
| ^~
a.cc:21:55: error: expected ')' before 'if'
21 | break;
| ^
| )
22 | if(fie[i][j] >= 0 && fie[i+1+add][k] >= 0){
| ~~
a.cc:20:43: note: to match this '('
20 | if(add+((u/2) > m)
| ^
a.cc:33:33: error: expected primary-expression before '}' token
33 | }
| ^
|
s587036434 | p00453 | C++ | #include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
template<class T> inline void chmin(T& a, T b) { if(b < a) a = b; }
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
for(int n, m; cin >> n >> m, n;) {
vector<vector<int> > pos(n), danger(n);
vector<vector<vector<int> > > dp(n, vector<vector<int> >(m + 1));
for(int i = 0; i < n; ++i) {
int num;
cin >> num;
for(int j = 0; j < m + 1; ++j)
dp[i][j].resize(num, INT_MAX);
for(int j = 0; j < num; ++j) {
int x, d;
cin >> x >> d;
pos[i].push_back(x);
danger[i].push_back(d);
}
}
for(int i = 0; i < m + 1; ++i)
for(int j = 0; j < dp[0][i].size(); ++j)
dp[0][i][j] = 0;
int ans = INT_MAX;
for(int i = 0; i < n; ++i) {
for(int j = 0; j < m + 1; ++j) {
for(int k = 0; k < dp[i][j].size(); ++k) {
if(dp[i][j][k] == INT_MAX)
continue;
if(j) {
if(i + 2 >= n)
chmin(ans, dp[i][j][k]);
else
for(int l = 0; l < dp[i + 2][j - 1].size(); ++l)
chmin(dp[i + 2][j - 1][l], dp[i][j][k] + (danger[i][k] + danger[i + 2][l]) * abs(pos[i][k] - pos[i + 2][l]));
}
if(i + 1 >= n)
chmin(ans, dp[i][j][k]);
else
for(int l = 0; l < dp[i + 1][j].size(); ++l)
chmin(dp[i + 1][j][l], dp[i][j][k] + (danger[i][k] + danger[i + 1][l]) * abs(pos[i][k] - pos[i + 1][l]));
}
}
}
cout << ans << endl;
}
return EXIT_SUCCESS;
} | a.cc: In function 'int main()':
a.cc:20:54: error: 'INT_MAX' was not declared in this scope
20 | dp[i][j].resize(num, INT_MAX);
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include <vector>
+++ |+#include <climits>
4 | using namespace std;
a.cc:34:27: error: 'INT_MAX' was not declared in this scope
34 | int ans = INT_MAX;
| ^~~~~~~
a.cc:34:27: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
|
s868077232 | p00453 | C++ | #include <cstdio>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define INF (1<<27)
int K[150]; //K[i]::=i行目に何個の石があるか
int X[10][150]; //X[i][j]::=j列目のi個目が何列目か
int D[10][150]; //D[i][j]::=j列目のi個目のすべりやすさ
int DP[10][150][80]; //DP[i][j][k]::=j列目のi個目にいて、あとk回ジャンプできる
int main() {
int N,M;
while(scanf("%d %d",&N,&M),N|M) {
memset(K,0,sizeof(K));
memset(X,0,sizeof(X));
memset(D,0,sizeof(D));
for(int y=0;y<N;y++) {
scanf("%d",&K[y]);
for(int x=0;x<K[y];x++) {
scanf("%d %d",&X[x][y],&D[x][y]);
}
}
fill((int*)DP,(int*)(DP+10),INF);
for(int x=0;x<K[0];x++) DP[x][0][M]=0;
for(int x=0;x<K[1];x++) DP[x][1][M-1]=0;
for(int y=1;y<N;y++) for(int x=0;x<K[y];x++) {
for(int xx=0;xx<K[y-1];xx++) for(int m=0;m<=M;m++) {
DP[x][y][m]=min(DP[x][y][m],DP[xx][y-1][m]+(D[x][y]+D[xx][y-1])*abs(X[x][y]-X[xx][y-1]));
}
if(y==1) continue;
for(int xx=0;xx<K[y-2];xx++) for(int m=0;m<=M;m++) {
DP[x][y][m]=min(DP[x][y][m],DP[xx][y-2][m+1]+(D[x][y]+D[xx][y-2])*abs(X[x][y]-X[xx][y-2]));
}
}
int ans=INF;
for(int x=0;x<K[N-2];x++) for(int m=1;m<=M;m++) {
ans=min(ans,DP[x][N-2][m]);
}
for(int x=0;x<K[N-1];x++) for(int m=0;m<=M;m++) {
ans=min(ans,DP[x][N-1][m]);
}
printf("%d\n",ans);
}
} | a.cc: In function 'int main()':
a.cc:14:17: error: 'memset' was not declared in this scope
14 | memset(K,0,sizeof(K));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <algorithm>
+++ |+#include <cstring>
5 | using namespace std;
|
s963084690 | p00453 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int z(int x){
if(x<0)return -x;
return x;
}
int main(){
while(1){
const long long int INF=1000000000000000000;
long long int n,m,k;
static long long int a[1002],b[152][1002],dp[152][1002][102];
for(int i=0;i<152;i++)for(int j=0;j<1002;j++)for(k=0;k<102;k++)dp[i][j][k]=INF;
scanf("%d%d",&n,&m);
if(n==0&&m==0)break;
for(int i=1;i<=n;i++){
scanf("%d",&k);
for(int j=0;j<k;j++){
scanf("%d",&a[j]);
scanf("%d",&b[i][a[j]]);
for(int c=0;c<=m;c++){
if(i==1)dp[i][a[j]][c]=0;
else {
for(int l=0;l<1002;l++){
if(dp[i-1][l][c]!=INF){
dp[i][a[j]][c]=min(dp[i][a[j]][c],dp[i-1][l][c]+z(l-a[j])*(b[i][a[j]]+b[i-1][l]));
}
if(c!=0){
if(dp[i-2][l][c-1]!=INF){
dp[i][a[j]][c]=min(dp[i][a[j]][c],dp[i-2][l][c-1]+z(l-a[j])*(b[i][a[j]]+b[i-2][l]));
}
}
}
}
}
}
}
int ret=INF;
for(int i=0;i<1002;i++)for(int j=0;j<=m;j++)ret=min(ret,dp[n][i][j]);
printf("%d\n",ret);
}
} | a.cc: In function 'int main()':
a.cc:40:17: warning: overflow in conversion from 'long long int' to 'int' changes value from '1000000000000000000' to '-1486618624' [-Woverflow]
40 | int ret=INF;
| ^~~
a.cc:41:60: error: no matching function for call to 'min(int&, long long int&)'
41 | for(int i=0;i<1002;i++)for(int j=0;j<=m;j++)ret=min(ret,dp[n][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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:41:60: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
41 | for(int i=0;i<1002;i++)for(int j=0;j<=m;j++)ret=min(ret,dp[n][i][j]);
| ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:41:60: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
41 | for(int i=0;i<1002;i++)for(int j=0;j<=m;j++)ret=min(ret,dp[n][i][j]);
| ~~~^~~~~~~~~~~~~~~~~
|
s903979550 | p00453 | C++ | //Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
//番号とx座標と滑りやすさ
vector<P1>s[155];
//滑りやすさ、x座標、y座標
P1 d[1505];
int n,m;
//石番号と残り数を状態にもつdijkstra用配列
int di[1505][76];
//beatmania iidx楽しい!!の部分文字列ではなくindexの部分文字列
int idx=0;
int main()
{
scanf("%d %d",&n,&m);
for(int i=1;i<=n;i++)
{
int k;
scanf("%d",&k);
for(int j=0;j<k;j++)
{
int a,b;
scanf("%d %d",&a,&b);
s[i].pb(mp(idx,mp(a,b)));
d[idx++]=mp(b,mp(a,i));
}
}
for(int i=0;i<1505;i++)for(int j=0;j<76;j++) di[i][j]=1e9;
priority_queue<P1,vector<P1>,greater<P1> >que;
for(int i=0;i<s[1].size();i++)
{
P1 p=s[1][i];
di[p.first][m]=0;
que.push(mp(0,mp(p.first,m)));
}
for(int i=0;m>0 && i<s[2].size();i++)
{
P1 p=s[2][i];
di[p.first][m-1]=0;
que.push(mp(0,mp(p.first,m-1)));
}
while(!que.empty())
{
P1 p=que.top();
que.pop();
int idd=p.second.first;
int slip1=d[idd].first;
int x=d[idd].second.first;
int y=d[idd].second.second;
int zan=p.second.second;
for(int i=0;i<s[y+1].size();i++)
{
P1 p=s[y+1][i];
int slip2=p.second.second;
int x2=p.second.first;
if(di[p.first][zan]>p.first+(slip1+slip2)*abs(x-x2))
{
di[p.first][zan]=p.first+(slip1+slip2)*abs(x-x2);
que.push(mp(di[p.first][zan],mp(p.first,zan)));
}
}
for(int i=0;zan>0 && <s[y+2].size();i++)
{
P1 p=s[y+2][i];
int slip2=p.second.second;
int x2=p.second.first;
if(di[p.first][zan]>p.first+(slip1+slip2)*abs(x-x2))
{
di[p.first][zan]=p.first+(slip1+slip2)*abs(x-x2);
que.push(mp(di[p.first][zan],mp(p.first,zan)));
}
}
}
int ret=INF;
for(int j=0;j<s[n].size();j++) for(int i=0;i<76;i++) ret=min(ret,di[s[n][j].first][i]);
for(int j=0;j<s[n-1].size();j++) for(int i=1;i<76;i++) ret=min(ret,di[s[n-1][j].first][i]);
printf("%d\n",ret);
} | a.cc: In function 'int main()':
a.cc:87:38: error: expected primary-expression before '<' token
87 | for(int i=0;zan>0 && <s[y+2].size();i++)
| ^
|
s667435217 | p00453 | C++ | //滑りやすさ>=0なら大丈夫.3Dにすると、メモリがたくさんいるので、2つのナップザックを使いまわす。
#include<iostream>
#include<stdlib.h>
#include<math.h>
using namespace std;
int N,M;
int pos[151][10]; //石のある場所(x座標)
int list[151][10]; //石の滑りやすさ
int minest[2][151][10]; //危険度ナップザック(探索用)
void ainst(int *a,int index,int num){
for(int i = 0;i < index;i++){
a[i] = num;
}s
}
void acopy(int *a,int *b,int index){
for(int i = 0;i < index;i++){
a[i] = b[i];
}
}
int amin(int *a,int index){
int min = a[0];
for(int i = 1;i < index;i++){
if(min > a[i])
min = a[i];
}
return min;
}
int nap(int n,int mode){ //mode:0のときは一行飛ばし可能、1のときは不可能
int i,j,l;
int min = 2000000000;
for(i = 0;i < n-1;i++){
for(j = 0;j < 10;j++){
if(pos[i][j] == -1)
break;
if(i+2 >= n && mode == 0){
if(min > minest[0][i][j])
min = minest[0][i][j];
}
for(l = 0;l < 10;l++){
switch(mode){
case 0:
if(i+2 < n && pos[i+2][l] >= 0){
if(minest[1][i+2][l] == -1 || minest[1][i+2][l] > minest[0][i][j]+(list[i][j]+list[i+2][l])*abs(pos[i][j]-pos[i+2][l])){
minest[1][i+2][l] = minest[0][i][j]+(list[i][j]+list[i+2][l])*abs(pos[i][j]-pos[i+2][l]);
}
}
case 1:
if(pos[i+1][l] >= 0){
if(minest[0][i+1][l] == -1 || minest[0][i+1][l] > minest[0][i][j]+(list[i][j]+list[i+1][l])*abs(pos[i][j]-pos[i+1][l])){
minest[0][i+1][l] = minest[0][i][j]+(list[i][j]+list[i+1][l])*abs(pos[i][j]-pos[i+1][l]);
}
}
break;
}
}
}
}
for(i = 0;i < 10;i++){
if(minest[0][n-1][i] != -1 && min > minest[0][n-1][i])
min = minest[0][n-1][i];
}
return min;
}
int main(){
int i,j,k;
int mcor,now,saisyo[1000];
int saicor = 0;
while(1){
cin >> N >> M;
if(N == 0 && M == 0)
break;
saisyo[saicor] = 2000000000;
for(i = 0;i < N;i++){
ainst(pos[i],10,-1);
ainst(list[i],10,-1);
ainst(minest[0][i],10,-1);
ainst(minest[1][i],10,-1);
cin >> k;
for(j = 0;j < k;j++){
cin >> pos[i][j] >> list[i][j];
}
}
ainst(minest[0][0],10,0);
ainst(minest[1][0],10,0);
//探索開始
for(mcor = 0;mcor <= M;mcor++){
if(mcor < M)
now = nap(N,0);
else
now = nap(N,1);
if(saisyo[saicor] > now)
saisyo[saicor] = now;
for(i = 0;i < N;i++){
acopy(minest[0][i],minest[1][i],10);
ainst(minest[1][i],10,-1);
}
ainst(minest[0][0],10,0);
ainst(minest[1][0],10,0);
}
saicor++;
}
for(i = 0;i < saicor;i++){
cout << saisyo[i] << endl;
}
return 0;
} | a.cc: In function 'void ainst(int*, int, int)':
a.cc:15:10: error: 's' was not declared in this scope
15 | }s
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.