Submission #1014870

#TimeUsernameProblemLanguageResultExecution timeMemory
1014870KindaGoodGamesKnapsack (NOI18_knapsack)C++14
Compilation error
0 ms0 KiB
• include <bits/stdc++.h>•  • #define ll long long• //#define int ll• #define pii pair<int, int>• #define tiii tuple<int, int, int>•  • using namespace std;•  • int32_t main()• {• ios_base::sync_with_stdio(false);• cin.tie(0);•  • int n, s;• cin >> s >> n;•  • vector<int> value(n), weight(n), capacity(n);•  • vector<int> dp(s+1);•  • for (int i = 0; i < n; i++)• {• cin >> value[i] >> weight[i] >> capacity[i];• }•  • if(n == 1){• cout << min(s/weight[0], capacity[0]) * value[0];• return 0;• }•  • for (int i = 0; i < n; i++)• {• for (int j = s; j > 0; j--)• {• //dp[j] = max(dp[j],dp[j - 1]);• if (j < weight[i])• continue;• for (int k = 1; k <= min(capacity[i],s); k++)• {• if(j-(k*weight[i]) < 0) break;• if(dp[j] <dp[j - (k*weight[i])] + (k*value[i])){• dp[j] = dp[j - (k*weight[i])] + (k*value[i]);• }• }• }• }•  • int ma = 0;• for(int i = 0; i <= s; i++){• ma = max(ma, dp[i]);• }• cout << ma;• }

Compilation message (stderr)

knapsack.cpp:1:1: error: extended character • is not valid in an identifier
    1 | • include <bits/stdc++.h>•  • #define ll long long• //#define int ll• #define pii pair<int, int>• #define tiii tuple<int, int, int>•  • using namespace std;•  • int32_t main()• {• ios_base::sync_with_stdio(false);• cin.tie(0);•  • int n, s;• cin >> s >> n;•  • vector<int> value(n), weight(n), capacity(n);•  • vector<int> dp(s+1);•  • for (int i = 0; i < n; i++)• {• cin >> value[i] >> weight[i] >> capacity[i];• }•  • if(n == 1){• cout << min(s/weight[0], capacity[0]) * value[0];• return 0;• }•  • for (int i = 0; i < n; i++)• {• for (int j = s; j > 0; j--)• {• //dp[j] = max(dp[j],dp[j - 1]);• if (j < weight[i])• continue;• for (int k = 1; k <= min(capacity[i],s); k++)• {• if(j-(k*weight[i]) < 0) break;• if(dp[j] <dp[j - (k*weight[i])] + (k*value[i])){• dp[j] = dp[j - (k*weight[i])] + (k*value[i]);• }• }• }• }•  • int ma = 0;• for(int i = 0; i <= s; i++){• ma = max(ma, dp[i]);• }• cout << ma;• }
      | ^
knapsack.cpp:1:28: error: extended character • is not valid in an identifier
    1 | • include <bits/stdc++.h>•  • #define ll long long• //#define int ll• #define pii pair<int, int>• #define tiii tuple<int, int, int>•  • using namespace std;•  • int32_t main()• {• ios_base::sync_with_stdio(false);• cin.tie(0);•  • int n, s;• cin >> s >> n;•  • vector<int> value(n), weight(n), capacity(n);•  • vector<int> dp(s+1);•  • for (int i = 0; i < n; i++)• {• cin >> value[i] >> weight[i] >> capacity[i];• }•  • if(n == 1){• cout << min(s/weight[0], capacity[0]) * value[0];• return 0;• }•  • for (int i = 0; i < n; i++)• {• for (int j = s; j > 0; j--)• {• //dp[j] = max(dp[j],dp[j - 1]);• if (j < weight[i])• continue;• for (int k = 1; k <= min(capacity[i],s); k++)• {• if(j-(k*weight[i]) < 0) break;• if(dp[j] <dp[j - (k*weight[i])] + (k*value[i])){• dp[j] = dp[j - (k*weight[i])] + (k*value[i]);• }• }• }• }•  • int ma = 0;• for(int i = 0; i <= s; i++){• ma = max(ma, dp[i]);• }• cout << ma;• }
      |                          ^
knapsack.cpp:1:32: error: extended character   is not valid in an identifier
    1 | • include <bits/stdc++.h>•  • #define ll long long• //#define int ll• #define pii pair<int, int>• #define tiii tuple<int, int, int>•  • using namespace std;•  • int32_t main()• {• ios_base::sync_with_stdio(false);• cin.tie(0);•  • int n, s;• cin >> s >> n;•  • vector<int> value(n), weight(n), capacity(n);•  • vector<int> dp(s+1);•  • for (int i = 0; i < n; i++)• {• cin >> value[i] >> weight[i] >> capacity[i];• }•  • if(n == 1){• cout << min(s/weight[0], capacity[0]) * value[0];• return 0;• }•  • for (int i = 0; i < n; i++)• {• for (int j = s; j > 0; j--)• {• //dp[j] = max(dp[j],dp[j - 1]);• if (j < weight[i])• continue;• for (int k = 1; k <= min(capacity[i],s); k++)• {• if(j-(k*weight[i]) < 0) break;• if(dp[j] <dp[j - (k*weight[i])] + (k*value[i])){• dp[j] = dp[j - (k*weight[i])] + (k*value[i]);• }• }• }• }•  • int ma = 0;• for(int i = 0; i <= s; i++){• ma = max(ma, dp[i]);• }• cout << ma;• }
      |                            ^
knapsack.cpp:1:32: error: extended character • is not valid in an identifier
knapsack.cpp:1:38: error: stray '#' in program
    1 | • include <bits/stdc++.h>•  • #define ll long long• //#define int ll• #define pii pair<int, int>• #define tiii tuple<int, int, int>•  • using namespace std;•  • int32_t main()• {• ios_base::sync_with_stdio(false);• cin.tie(0);•  • int n, s;• cin >> s >> n;•  • vector<int> value(n), weight(n), capacity(n);•  • vector<int> dp(s+1);•  • for (int i = 0; i < n; i++)• {• cin >> value[i] >> weight[i] >> capacity[i];• }•  • if(n == 1){• cout << min(s/weight[0], capacity[0]) * value[0];• return 0;• }•  • for (int i = 0; i < n; i++)• {• for (int j = s; j > 0; j--)• {• //dp[j] = max(dp[j],dp[j - 1]);• if (j < weight[i])• continue;• for (int k = 1; k <= min(capacity[i],s); k++)• {• if(j-(k*weight[i]) < 0) break;• if(dp[j] <dp[j - (k*weight[i])] + (k*value[i])){• dp[j] = dp[j - (k*weight[i])] + (k*value[i]);• }• }• }• }•  • int ma = 0;• for(int i = 0; i <= s; i++){• ma = max(ma, dp[i]);• }• cout << ma;• }
      |                               ^
knapsack.cpp:1:54: error: extended character • is not valid in an identifier
    1 | • include <bits/stdc++.h>•  • #define ll long long• //#define int ll• #define pii pair<int, int>• #define tiii tuple<int, int, int>•  • using namespace std;•  • int32_t main()• {• ios_base::sync_with_stdio(false);• cin.tie(0);•  • int n, s;• cin >> s >> n;•  • vector<int> value(n), weight(n), capacity(n);•  • vector<int> dp(s+1);•  • for (int i = 0; i < n; i++)• {• cin >> value[i] >> weight[i] >> capacity[i];• }•  • if(n == 1){• cout << min(s/weight[0], capacity[0]) * value[0];• return 0;• }•  • for (int i = 0; i < n; i++)• {• for (int j = s; j > 0; j--)• {• //dp[j] = max(dp[j],dp[j - 1]);• if (j < weight[i])• continue;• for (int k = 1; k <= min(capacity[i],s); k++)• {• if(j-(k*weight[i]) < 0) break;• if(dp[j] <dp[j - (k*weight[i])] + (k*value[i])){• dp[j] = dp[j - (k*weight[i])] + (k*value[i]);• }• }• }• }•  • int ma = 0;• for(int i = 0; i <= s; i++){• ma = max(ma, dp[i]);• }• cout << ma;• }
      |                                               ^
knapsack.cpp:1:1: error: '\U00002022' does not name a type
    1 | • include <bits/stdc++.h>•  • #define ll long long• //#define int ll• #define pii pair<int, int>• #define tiii tuple<int, int, int>•  • using namespace std;•  • int32_t main()• {• ios_base::sync_with_stdio(false);• cin.tie(0);•  • int n, s;• cin >> s >> n;•  • vector<int> value(n), weight(n), capacity(n);•  • vector<int> dp(s+1);•  • for (int i = 0; i < n; i++)• {• cin >> value[i] >> weight[i] >> capacity[i];• }•  • if(n == 1){• cout << min(s/weight[0], capacity[0]) * value[0];• return 0;• }•  • for (int i = 0; i < n; i++)• {• for (int j = s; j > 0; j--)• {• //dp[j] = max(dp[j],dp[j - 1]);• if (j < weight[i])• continue;• for (int k = 1; k <= min(capacity[i],s); k++)• {• if(j-(k*weight[i]) < 0) break;• if(dp[j] <dp[j - (k*weight[i])] + (k*value[i])){• dp[j] = dp[j - (k*weight[i])] + (k*value[i]);• }• }• }• }•  • int ma = 0;• for(int i = 0; i <= s; i++){• ma = max(ma, dp[i]);• }• cout << ma;• }
      | ^