submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s901495601
|
p04013
|
C++
|
#include<iostream>
using namespace std;
typedef long long ll;
const int N = 55;
int n, A;
int a[N];
ll mem[N][N][N * N];
ll dp(int i, int cnt, int sum) {
if (i == n) {
if (cnt == 0)return 0;
if ((sum / cnt == A) && (sum % cnt == 0))return 1;
return 0;
}
ll& ret = mem[i][cnt][sum];
cout << mem[i][cnt][sum] << endl;
if (ret != -1)return ret;
return ret = dp(i + 1, cnt, sum) + dp(i + 1, cnt + 1, sum + a[i]);
}
int main() {
scanf("%d %d", &n, &A);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
memset(mem, -1, sizeof mem);
printf("%lld\n", dp(0, 0, 0));
return 0;
}
|
a.cc: In function 'int main()':
a.cc:36:9: error: 'memset' was not declared in this scope
36 | memset(mem, -1, sizeof mem);
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 | using namespace std;
|
s466417738
|
p04013
|
C++
|
#include <bits/stdc++.h>
using namespace std;
void subsetsUtil(vector<int>& A, vector<vector<int> >& res,
vector<int>& subset, int index)
{
res.push_back(subset);
for (int i = index; i < A.size(); i++) {
subset.push_back(A[i]);
subsetsUtil(A, res, subset, i + 1);
subset.pop_back();
}
return;
}
vector<vector<int> > subsets(vector<int>& A)
{
vector<int> subset;
vector<vector<int> > res;
int index = 0;
subsetsUtil(A, res, subset, index);
return res;
}
int main()
{
vector<int> array;
int cnt=0;
int n,a;
cin>>n>>a;
for(int i=1;i<=n;i++) {
int x;cin>>x;
array.push_back(x);
}
vector<vector<int> > res = subsets(array);
for (int i = 0; i < res.size(); i++) {
int sum=0;
for (int j = 0; j < res[i].size(); j++)
sum+=res[i][j];
if(sum/res[i].size())==a) cnt++;
}
cout<<cnt<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:49:38: error: expected primary-expression before '==' token
49 | if(sum/res[i].size())==a) cnt++;
| ^~
|
s905067344
|
p04013
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<char,char> PCC;
typedef pair<ll,ll> PLL;
typedef pair<char,int> PCI;
typedef pair<int,char> PIC;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<ll,char> PLC;
typedef pair<char,ll> PCL;
inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}
const int M = 51;
int main(void){
SPEEDUP
cout << setprecision(15);
int N,A;cin >> N >> A;
vector<int> v(N);
rep(i,N)cin >> v[i];
//dp[i][j+M*M*k];
ll dp[2][M*M*M];
ll *prev,*next;
prev = dp[0];
next = dp[1];
rep(i,M*M*M+1){
prev[i] = 0;
next[i] = 0;
}
prev[0] = 1;
next[0] = 1;
rep(i,N){
repp(k,1,i+2){
rep(j,M*M){
next[j+M*M*k] = prev[j+M*M*k];
if(j-v[i]<0)continue;
next[j+M*M*k] += prev[j-v[i] + M*M*(k-1)];
}
}
swap(prev,next);
}
swap(prev,next);
ll ans = 0;
repp(i,1,N+1) ans += next[A*i+M*M*i];
cout << ans << endl;
return 0;
}t
|
a.cc:67:2: error: 't' does not name a type; did you mean 'tm'?
67 | }t
| ^
| tm
|
s802299079
|
p04013
|
C++
|
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
#define repprev(i,a,b) for(ll i=b-1;i>=a;i--)
#define reprev(i,n) repprev(i,0,n)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> int former(const vector<T> &v, T x){
return upper_bound(v.begin(),v.end(),x) - v.begin() - 1;
}
template<class T> int latter(const vector<T> &v, T x){
return lower_bound(v.begin(),v.end(),x) - v.begin();
}
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
#define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010
#define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100
#define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000
#define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000
#define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000
#define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000
#define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INTINF = 1<<29;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct UnionFind {
vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
UnionFind(ll n) : par(n, -1) { }
void init(ll n) { par.assign(n, -1); }
ll root(ll x) {
if (par[x] < 0) return x;
else return par[x] = root(par[x]);
}
bool issame(ll x, ll y) {
return root(x) == root(y);
}
bool merge(ll x, ll y) {
x = root(x); y = root(y);
if (x == y) return false;
if (par[x] > par[y]) swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
ll size(ll x) {
return -par[root(x)];
}
};
template <typename T>
vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){
const T INF = numeric_limits<T>::max();
using P = pair<T, int>;
int n=G.size();
vector<T> d(n,INF);
vector<int> b(n,-1);
priority_queue<P,vector<P>,greater<P> > q;
d[s]=0;
q.emplace(d[s],s);
while(!q.empty()){
P p=q.top();q.pop();
int v=p.second;
if(d[v]<p.first) continue;
for(auto& e:G[v]){
int u=e.first;
T c=e.second;
if(d[u]>d[v]+c){
d[u]=d[v]+c;
b[u]=v;
q.emplace(d[u],u);
}
}
}
return d;
}
vector<vector<int> > bfs(vector<string> &s,int sy,int sx,char wall,int dir){
int h=s.size(),w=s.front().size();
vector<vector<int> > dp(h,vector<int>(w,-1));
using P = pair<int, int>;
queue<P> q;
dp[sy][sx]=0;
q.emplace(sy,sx);
int dy[]={1,-1,0,0,1,1,-1,-1};
int dx[]={0,0,1,-1,1,-1,1,-1};
auto in=[&](int y,int x){return 0<=y&&y<h&&0<=x&&x<w;};
while(!q.empty()){
int y,x;
tie(y,x)=q.front();q.pop();
for(int k=0;k<dir;k++){
int ny=y+dy[k],nx=x+dx[k];
if(!in(ny,nx)||s[ny][nx]==wall) continue;
if(~dp[ny][nx]) continue;
dp[ny][nx]=dp[y][x]+1;
q.emplace(ny,nx);
}
}
return dp;
}
std::vector<ll> divisor(ll n)//nの約数を列挙
{
std::vector<ll> ret;
for(ll i=1 ; i*i<=n ; ++i)
{
if(n%i == 0)
{
ret.push_back(i);
if(i!=1 && i*i!=n)
{
ret.push_back(n/i);
}
}
}
return ret;
}
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
using Edge = pair<int,int>;
using Graph = vector<vector<Edge> >;
int N;
Graph G;
vector<int> res;
int dp[52][52][52];
int main(void) {
ios::sync_with_stdio(false);
cin.tie(0);
int N,A;
cin >> N >> A;
vector<int> x(N);
rep(i,N) cin >> x[i];
dp[0][0][0] = 1;
REP(i, 1, N){
REP(j, 1, N){
REP(k, 1, 2500){
if(k < x[i]) dp[i][j][k] = dp[i-1][j][k];
else dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][s-x[i]];
}
}
}
int ans = 0;
REP(i,1,N) ans += dp[N][i][i * A];
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:188:77: error: 's' was not declared in this scope
188 | else dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][s-x[i]];
| ^
|
s320894183
|
p04013
|
C++
|
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
#define repprev(i,a,b) for(ll i=b-1;i>=a;i--)
#define reprev(i,n) repprev(i,0,n)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> int former(const vector<T> &v, T x){
return upper_bound(v.begin(),v.end(),x) - v.begin() - 1;
}
template<class T> int latter(const vector<T> &v, T x){
return lower_bound(v.begin(),v.end(),x) - v.begin();
}
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
#define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010
#define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100
#define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000
#define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000
#define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000
#define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000
#define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INTINF = 1<<29;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct UnionFind {
vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
UnionFind(ll n) : par(n, -1) { }
void init(ll n) { par.assign(n, -1); }
ll root(ll x) {
if (par[x] < 0) return x;
else return par[x] = root(par[x]);
}
bool issame(ll x, ll y) {
return root(x) == root(y);
}
bool merge(ll x, ll y) {
x = root(x); y = root(y);
if (x == y) return false;
if (par[x] > par[y]) swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
ll size(ll x) {
return -par[root(x)];
}
};
template <typename T>
vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){
const T INF = numeric_limits<T>::max();
using P = pair<T, int>;
int n=G.size();
vector<T> d(n,INF);
vector<int> b(n,-1);
priority_queue<P,vector<P>,greater<P> > q;
d[s]=0;
q.emplace(d[s],s);
while(!q.empty()){
P p=q.top();q.pop();
int v=p.second;
if(d[v]<p.first) continue;
for(auto& e:G[v]){
int u=e.first;
T c=e.second;
if(d[u]>d[v]+c){
d[u]=d[v]+c;
b[u]=v;
q.emplace(d[u],u);
}
}
}
return d;
}
vector<vector<int> > bfs(vector<string> &s,int sy,int sx,char wall,int dir){
int h=s.size(),w=s.front().size();
vector<vector<int> > dp(h,vector<int>(w,-1));
using P = pair<int, int>;
queue<P> q;
dp[sy][sx]=0;
q.emplace(sy,sx);
int dy[]={1,-1,0,0,1,1,-1,-1};
int dx[]={0,0,1,-1,1,-1,1,-1};
auto in=[&](int y,int x){return 0<=y&&y<h&&0<=x&&x<w;};
while(!q.empty()){
int y,x;
tie(y,x)=q.front();q.pop();
for(int k=0;k<dir;k++){
int ny=y+dy[k],nx=x+dx[k];
if(!in(ny,nx)||s[ny][nx]==wall) continue;
if(~dp[ny][nx]) continue;
dp[ny][nx]=dp[y][x]+1;
q.emplace(ny,nx);
}
}
return dp;
}
std::vector<ll> divisor(ll n)//nの約数を列挙
{
std::vector<ll> ret;
for(ll i=1 ; i*i<=n ; ++i)
{
if(n%i == 0)
{
ret.push_back(i);
if(i!=1 && i*i!=n)
{
ret.push_back(n/i);
}
}
}
return ret;
}
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
using Edge = pair<int,int>;
using Graph = vector<vector<Edge> >;
int N;
Graph G;
vector<int> res;
int dp[52][52][52];
int main(void) {
ios::sync_with_stdio(false);
cin.tie(0);
int N,A;
cin >> N >> A;
vector<int> x(N);
rep(i,N) cin >> x[i];
int X = max(x);
dp[0][0][0] = 1;
REP(i, 1, N){
REP(j, 1, N){
REP(k, 1, N * X){
if(k < x[i]) dp[i][j][k] = dp[i-1][j][k];
else dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][s-x[i]];
}
}
}
int ans = 0;
REP(i,1,N) ans += dp[N][i][i * A];
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:183:20: error: no matching function for call to 'max(std::vector<int>&)'
183 | int X = max(x);
| ~~~^~~
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: candidate expects 2 arguments, 1 provided
/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, 1 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: template argument deduction/substitution failed:
a.cc:183:20: note: 'std::vector<int>' is not derived from 'std::initializer_list<_Tp>'
183 | int X = max(x);
| ~~~^~~
/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: candidate expects 2 arguments, 1 provided
a.cc:189:77: error: 's' was not declared in this scope
189 | else dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][s-x[i]];
| ^
|
s836984566
|
p04013
|
C++
|
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
#define repprev(i,a,b) for(ll i=b-1;i>=a;i--)
#define reprev(i,n) repprev(i,0,n)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> int former(const vector<T> &v, T x){
return upper_bound(v.begin(),v.end(),x) - v.begin() - 1;
}
template<class T> int latter(const vector<T> &v, T x){
return lower_bound(v.begin(),v.end(),x) - v.begin();
}
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
#define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010
#define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100
#define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000
#define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000
#define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000
#define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000
#define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INTINF = 1<<29;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct UnionFind {
vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
UnionFind(ll n) : par(n, -1) { }
void init(ll n) { par.assign(n, -1); }
ll root(ll x) {
if (par[x] < 0) return x;
else return par[x] = root(par[x]);
}
bool issame(ll x, ll y) {
return root(x) == root(y);
}
bool merge(ll x, ll y) {
x = root(x); y = root(y);
if (x == y) return false;
if (par[x] > par[y]) swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
ll size(ll x) {
return -par[root(x)];
}
};
template <typename T>
vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){
const T INF = numeric_limits<T>::max();
using P = pair<T, int>;
int n=G.size();
vector<T> d(n,INF);
vector<int> b(n,-1);
priority_queue<P,vector<P>,greater<P> > q;
d[s]=0;
q.emplace(d[s],s);
while(!q.empty()){
P p=q.top();q.pop();
int v=p.second;
if(d[v]<p.first) continue;
for(auto& e:G[v]){
int u=e.first;
T c=e.second;
if(d[u]>d[v]+c){
d[u]=d[v]+c;
b[u]=v;
q.emplace(d[u],u);
}
}
}
return d;
}
vector<vector<int> > bfs(vector<string> &s,int sy,int sx,char wall,int dir){
int h=s.size(),w=s.front().size();
vector<vector<int> > dp(h,vector<int>(w,-1));
using P = pair<int, int>;
queue<P> q;
dp[sy][sx]=0;
q.emplace(sy,sx);
int dy[]={1,-1,0,0,1,1,-1,-1};
int dx[]={0,0,1,-1,1,-1,1,-1};
auto in=[&](int y,int x){return 0<=y&&y<h&&0<=x&&x<w;};
while(!q.empty()){
int y,x;
tie(y,x)=q.front();q.pop();
for(int k=0;k<dir;k++){
int ny=y+dy[k],nx=x+dx[k];
if(!in(ny,nx)||s[ny][nx]==wall) continue;
if(~dp[ny][nx]) continue;
dp[ny][nx]=dp[y][x]+1;
q.emplace(ny,nx);
}
}
return dp;
}
std::vector<ll> divisor(ll n)//nの約数を列挙
{
std::vector<ll> ret;
for(ll i=1 ; i*i<=n ; ++i)
{
if(n%i == 0)
{
ret.push_back(i);
if(i!=1 && i*i!=n)
{
ret.push_back(n/i);
}
}
}
return ret;
}
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
using Edge = pair<int,int>;
using Graph = vector<vector<Edge> >;
int N;
Graph G;
vector<int> res;
int dp[52][52][52];
int main(void) {
ios::sync_with_stdio(false);
cin.tie(0);
int N,A;
cin >> N >> A;
vector<int> x(N);
rep(i,N) cin >> x[i];
int X = max(x);
dp[0][0][0] = 1;
REP(i, 1, N){
REP(j, 1, N){
REP(k, 1, N * X){
if(k < x[i]) dp[i][j][k] = dp[i-1][j][k];
else dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][s-x[i]];
}
}
}
int ans = 0;
REP(i,1,N) ans += dp[N][i][i * A];
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:183:20: error: no matching function for call to 'max(std::vector<int>&)'
183 | int X = max(x);
| ~~~^~~
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: candidate expects 2 arguments, 1 provided
/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, 1 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: template argument deduction/substitution failed:
a.cc:183:20: note: 'std::vector<int>' is not derived from 'std::initializer_list<_Tp>'
183 | int X = max(x);
| ~~~^~~
/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: candidate expects 2 arguments, 1 provided
a.cc:189:77: error: 's' was not declared in this scope
189 | else dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][s-x[i]];
| ^
|
s058699033
|
p04013
|
C++
|
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::cmp::{max, min};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
(source = $s:expr, $($r:tt)*) => {
let mut iter = $s.split_whitespace();
input_inner!{iter, $($r)*}
};
($($r:tt)*) => {
let s = {
use std::io::Read;
let mut s = String::new();
std::io::stdin().read_to_string(&mut s).unwrap();
s
};
let mut iter = s.split_whitespace();
input_inner!{iter, $($r)*}
};
}
#[allow(unused_macros)]
macro_rules! input_inner {
($iter:expr) => {};
($iter:expr, ) => {};
($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
let $var = read_value!($iter, $t);
input_inner!{$iter $($r)*}
};
}
#[allow(unused_macros)]
macro_rules! read_value {
($iter:expr, ( $($t:tt),* )) => {
( $(read_value!($iter, $t)),* )
};
($iter:expr, [ $t:tt ; $len:expr ]) => {
(0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
};
($iter:expr, chars) => {
read_value!($iter, String).chars().collect::<Vec<char>>()
};
($iter:expr, usize1) => {
read_value!($iter, usize) - 1
};
($iter:expr, $t:ty) => {
$iter.next().unwrap().parse::<$t>().expect("Parse error")
};
}
fn main() {
input! {
n: u64,
a: u64,
xs: [u64; n],
}
let mut hm = HashMap::new();
for x in xs.iter() {
if hm.contains_key(x) {
let h = hm.get_mut(x).unwrap();
*h += 1;
} else {
hm.insert(x, 1);
}
}
let mut cnt = 0;
// 1 << d := pow(2, d)
for i in 0..1 << xs.len() {
let mut sum = 0;
let mut ret = 0;
for j in 0..xs.len() {
// iのj番目ビットが立っているか -> jがiに含まれるか
if 1 << j & i == 0 {
sum += xs[j];
ret += 1;
}
}
if ret != 0 && sum % ret == 0 && sum / ret == a {
cnt+=1;
}
}
println!("{}", cnt);
}
|
a.cc:1:2: error: invalid preprocessing directive #!
1 | #![allow(unused_mut)]
| ^
a.cc:2:2: error: invalid preprocessing directive #!
2 | #![allow(non_snake_case)]
| ^
a.cc:3:2: error: invalid preprocessing directive #!
3 | #![allow(unused_imports)]
| ^
a.cc:10:2: error: invalid preprocessing directive #[
10 | #[allow(unused_macros)]
| ^
a.cc:28:2: error: invalid preprocessing directive #[
28 | #[allow(unused_macros)]
| ^
a.cc:39:2: error: invalid preprocessing directive #[
39 | #[allow(unused_macros)]
| ^
a.cc:46:10: error: too many decimal points in number
46 | (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
| ^~~~~~~
a.cc:79:14: error: too many decimal points in number
79 | for i in 0..1 << xs.len() {
| ^~~~
a.cc:82:18: error: too many decimal points in number
82 | for j in 0..xs.len() {
| ^~~~~~~~~
a.cc:4:1: error: 'use' does not name a type
4 | use std::collections::HashSet;
| ^~~
a.cc:5:1: error: 'use' does not name a type
5 | use std::collections::HashMap;
| ^~~
a.cc:6:1: error: 'use' does not name a type
6 | use std::collections::BTreeSet;
| ^~~
a.cc:7:1: error: 'use' does not name a type
7 | use std::collections::VecDeque;
| ^~~
a.cc:8:1: error: 'use' does not name a type
8 | use std::cmp::{max, min};
| ^~~
a.cc:11:1: error: 'macro_rules' does not name a type
11 | macro_rules! input {
| ^~~~~~~~~~~
a.cc:29:1: error: 'macro_rules' does not name a type
29 | macro_rules! input_inner {
| ^~~~~~~~~~~
a.cc:40:1: error: 'macro_rules' does not name a type
40 | macro_rules! read_value {
| ^~~~~~~~~~~
a.cc:61:1: error: 'fn' does not name a type
61 | fn main() {
| ^~
|
s482297370
|
p04013
|
C++
|
typedef long long ll;
int N, A;
int x[50];
ll dp[51][51][3010];
//-----------------------------------------------------------------
int main() {
cin >> N >> A;
rep(i, N) cin >> x[i];
dp[0][0][0] = 1;
rep(i,N){
rep(j,N){
rep(k,2500){
if(dp[i][j][k]){
dp[i + 1][j][k] += dp[i][j][k];
dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
}
ll ans = 0;
REP(i,1,N+1) ans += dp[N][i][i*A];
cout << ans << endl;
}
}
}
}
|
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
7 | cin >> N >> A;
| ^~~
a.cc:8:13: error: 'i' was not declared in this scope
8 | rep(i, N) cin >> x[i];
| ^
a.cc:8:9: error: 'rep' was not declared in this scope
8 | rep(i, N) cin >> x[i];
| ^~~
|
s915410220
|
p04013
|
C++
|
87654
30
|
a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 87654
| ^~~~~
|
s074311390
|
p04013
|
C++
|
einclude <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
typedef long long ll;
using namespace std;
template <typename T> void output(T, int);
template <typename T> T max(T, T);
int gcd(int a, int b);
int main() {
// source
int n, a;
cin >> n >> a;
int x[n];
rep(i, n) {
int temp;
cin >> temp;
x[i] = temp - a;
}
int minus_sum = 0, plus_sum = 0;
rep(i, n) {
if (x[i] > 0) {
plus_sum += x[i];
} else {
minus_sum += x[i];
}
}
ll dp[n][plus_sum - minus_sum + 1] = {};
dp[0][x[0] - minus_sum] = 1;
dp[0][-minus_sum] += 1;
repd(l0, 1, n) {
rep(l1, plus_sum - minus_sum + 1) {
if (0 <= l1 - x[l0] && l1 - x[l0] < plus_sum - minus_sum + 1) {
dp[l0][l1] = dp[l0 - 1][l1] + dp[l0 - 1][l1 - x[l0]];
} else {
dp[l0][l1] = dp[l0 - 1][l1];
}
}
}
cout << dp[n - 1][-minus_sum] - 1 << endl;
return 0;
}
template <typename T> void output(T a, int precision) {
if (precision > 0) {
cout << setprecision(precision) << a << "\n";
} else {
cout << a << "\n";
}
}
template <typename T> T max(T a, T b) {
if (a > b) {
return a;
} else {
return b;
}
}
template <typename T> T min(T a, T b) {
if (a < b) {
return a;
} else {
return b;
}
}
int gcd(int a, int b) {
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
|
a.cc:1:1: error: 'einclude' does not name a type
1 | einclude <algorithm>
| ^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/bitset:49,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
|
s146240879
|
p04013
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int n,avg;
vector<int> v;
int main()
{
cin>>n>>avg;
v.resize(n);
for(int &i:v) cin>>i;
vector<vector<long long int>> dp(n+1,vector<int>(2501));
dp[0][0]=1;
for(int i=0;i<n;i++)
{
for(int j=i;j>=0;j--)
{
for(int k=0;k<=2500;k++)
{
if(dp[j][k]!=0)
dp[j+1][k+v[i]] += dp[j][k];
}
}
}
long long ans = 0;
for(int i=1;i<=n;i++)
{
ans += dp[i][avg*i];
}
cout<<ans<<"\n";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:56: error: no matching function for call to 'std::vector<std::vector<long long int> >::vector(int, std::vector<int>)'
11 | vector<vector<long long int>> dp(n+1,vector<int>(2501));
| ^
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed:
a.cc:11:56: note: deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<int>')
11 | vector<vector<long long int>> dp(n+1,vector<int>(2501));
| ^
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; allocator_type = std::allocator<std::vector<long long int> >]'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<long long int> >'
678 | vector(initializer_list<value_type> __l,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<long long int> >]'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<long long int> >&&'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ~~~~~~~~~^~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; allocator_type = std::allocator<std::vector<long long int> >; std::false_type = std::false_type]'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; allocator_type = std::allocator<std::vector<long long int> >; std::true_type = std::true_type]'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<long long int> >]'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<long long int> >&'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; size_type = long unsigned int; value_type = std::vector<long long int>; allocator_type = std::allocator<std::vector<long long int> >]'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<std::vector<long long int> >::value_type&' {aka 'const std::vector<long long int>&'}
569 | vector(size_type __n, const value_type& __value,
| ~~~~~~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<long long int> >]'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<std::vector<long long int> >::allocator_type&' {aka 'const std::allocator<std::vector<long long int> >&'}
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; allocator_type = std::allocator<std::vector<long long int> >]'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
|
s399792984
|
p04013
|
C++
|
#include<bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int _b=(b),i=(a);i<=_b;++i)
#define ROF(i, b, a) for(int _a=(a),i=(b);i>=_a;--i)
#define REP(n) for(int _n=(n);_n--;)
#define _1 first
#define _2 second
#define PB(x) push_back(x)
#define SZ(x) int((x).size())
#define ALL(x) (x).begin(), (x).end()
#define MSET(m,v) memset(m,v,sizeof(m))
#define MAX_PQ(T) priority_queue<T>
#define MIN_PQ(T) priority_queue<T,vector<T>,greater<T>>
#define IO(){ios_base::sync_with_stdio(0);cin.tie(0);}
#define cint1(a) int a;cin>>a
#define cint2(a,b) int a,b;cin>>a>>b
#define cint3(a,b,c) int a,b,c;cin>>a>>b>>c
typedef long long int ll; typedef pair<int,int> PII;typedef unsigned long long int ull;
typedef vector<int>VI; typedef vector<ll> VL; typedef vector<PII> VP;
template<class A,class B>inline bool mina(A &x,const B &y){return(y<x)?(x=y,1):0;}
template<class A,class B>inline bool maxa(A &x,const B &y){return(x<y)?(x=y,1):0;}
int x[55];
int dp[55][2750];
int main() {
IO();
cint2(N, A);
FOR(i, 1, N) cin >> x[i];
MSET(dp, 0);
dp[0][0] = 1;
//int tot = 0;
FOR(i, 1, N) {
ROF(j, i-1, 0) {
FOR(k, 0, 2500) {
dp[j+1][x[i] + k] += dp[j][k];
}
}
tot += x[i];
}
ll res = 0;
FOR(i, 1, N) res += dp[i][i*A];
printf("%lld\n",res);;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:38:17: error: 'tot' was not declared in this scope
38 | tot += x[i];
| ^~~
|
s434225377
|
p04013
|
C++
|
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main(void){
int N,i,j,A,k;
cin >> N >> A;
int x[N];
for(i=0;i<N;i++){
cin >> x[i];
}
bool dpbool[N+1][N+1][N*50+1];
long dp[N+1][N+1][N*50+1];
for(int i=0; i<N; i++) {
for(int j=0; j<N1; j++) {
for(int k=0; k<N*50+1; k++) {
dp[i][j][k]=0;
dpbool[i][j][k]=false;
}
}
}
dpbool[0][0][0] = true;
dp[0][0][0] = 1;
for(i=0;i<N;i++){
for(j=0;j<N;j++){
for(k=0;k<N*50+1;k++){
if(dpbool[i][j][k] == true){
dp[i+1][j][k] += dp[i][j][k];
dp[i+1][j+1][k + x[i]] += dp[i][j][k];
dpbool[i+1][j][k] = true;
dpbool[i+1][j+1][k + x[i]] = true;
}
}
}
}
int sum = 0;
for(int j=0; j<N; j++) {
sum += dp[N][j][j*A];
}
cout << sum ;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:14:32: error: 'N1' was not declared in this scope; did you mean 'N'?
14 | for(int j=0; j<N1; j++) {
| ^~
| N
|
s440024945
|
p04013
|
C++
|
#include <bits/stdc++.h>
#define pb push_back
#define tam 310000
#define se second
#define fi first
#define forr(i,p,n) for(ll i=p;i<n;i++)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
typedef pair<ll,ll> ii;
int val[tam];
int main()
{
map<int,int> mp;
int n,a;
cin>>n>>a;
ll tot=0,sum=0;
forr(i,0,n)
{
cin>>val[i];
val[i]-=a;
}
int n1;
n1=n/2;
int n2=n-n1;
unordered_map<int,ll> mask1,mask2;
forr(i,1,(1<<n1))
{
tot=0;
forr(j,0,n1)
{
if ((i&(1<<j)))
tot+=val[j];
}
mask1[tot]++;
}
forr(i,1,(1<<n2))
{
tot=0;
forr(j,0,(n2))
{
if ((i&(1<<j)))
tot+=val[j+n/2];
}
mask2[tot]++;
}
sum=mask1[0]+mask2[0];
//cout<<sum<<" ";
for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
{
sum+=(ite->se)*(mask2[-ite->first]);
}
cout<<sum<<endl;
}
|
a.cc: In function 'int main()':
a.cc:51:46: error: conversion from 'std::unordered_map<int, long long int>::iterator' {aka 'std::__detail::_Insert_base<int, std::pair<const int, long long int>, std::allocator<std::pair<const int, long long int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::iterator'} to non-scalar type 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} requested
51 | for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
| ~~~~~~~~~~~^~
a.cc:51:52: error: no match for 'operator!=' (operand types are 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} and 'std::unordered_map<int, long long int>::iterator' {aka 'std::__detail::_Insert_base<int, std::pair<const int, long long int>, std::allocator<std::pair<const int, long long int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::iterator'})
51 | for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
| ~~~^~~~~~~~~~~~~
| | |
| | std::unordered_map<int, long long int>::iterator {aka std::__detail::_Insert_base<int, std::pair<const int, long long int>, std::allocator<std::pair<const int, long long int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::iterator}
| std::map<int, long long int>::iterator {aka std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator}
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:1132:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1132 | operator!=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1132:5: note: template argument deduction/substitution failed:
a.cc:51:64: note: 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
51 | for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
| ^
/usr/include/c++/14/bits/regex.h:1212: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>&)'
1212 | operator!=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1212:5: note: template argument deduction/substitution failed:
a.cc:51:64: note: 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
51 | for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
| ^
/usr/include/c++/14/bits/regex.h:1305: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>&)'
1305 | operator!=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1305:5: note: template argument deduction/substitution failed:
a.cc:51:64: note: 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
51 | for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
| ^
/usr/include/c++/14/bits/regex.h:1379:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1379 | operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1379:5: note: template argument deduction/substitution failed:
a.cc:51:64: note: 'std::unordered_map<int, long long int>::iterator' {aka 'std::__detail::_Insert_base<int, std::pair<const int, long long int>, std::allocator<std::pair<const int, long long int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
51 | for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
| ^
/usr/include/c++/14/bits/regex.h:1473:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1473 | operator!=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1473:5: note: template argument deduction/substitution failed:
a.cc:51:64: note: 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
51 | for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
| ^
/usr/include/c++/14/bits/regex.h:1547:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1547 | operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1547:5: note: template argument deduction/substitution failed:
a.cc:51:64: note: 'std::unordered_map<int, long long int>::iterator' {aka 'std::__detail::_Insert_base<int, std::pair<const int, long long int>, std::allocator<std::pair<const int, long long int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
51 | for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
| ^
/usr/include/c++/14/bits/regex.h:1647:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1647 | operator!=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1647:5: note: template argument deduction/substitution failed:
a.cc:51:64: note: 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
51 | for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
| ^
/usr/include/c++/14/bits/regex.h:2213:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator!=(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2213 | operator!=(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2213:5: note: template argument deduction/substitution failed:
a.cc:51:64: note: 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
51 | for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from
|
s790707461
|
p04013
|
C++
|
#include <bits/stdc++.h>
using namespace std;
long long dp[60][60][2600];
int main() {
long long N,A;
cin >> N >> A;
vector<long long> x(N+10);
for(int i=1;i<=N;i++)cin >> x[i];
dp[0][0][0]=1;
for(int i=1;i<=N;i++){
for(int j=1;j<=i;j++){
for(int k=1;k<=N*A;k++){
dp[i][j-1][k]=dp[i-1][j-1][k];
if(i>j && j>=x[i]){dp[i][j][k]=dp[i-1][j-1][k]+dp[i-1][j-1][k-x[i]];}
}
}
}
long long cnt=0;
for(int i=1;i<=N;i++){
for(int j=1;j<=i;j++){
for(int k=1;k<=N*A;k++){
if(j*A==dp[i][j][k]){cnt+=dp[i][j][k];}
}
}
}
cout << cnt << endl;
|
a.cc: In function 'int main()':
a.cc:27:23: error: expected '}' at end of input
27 | cout << cnt << endl;
| ^
a.cc:5:12: note: to match this '{'
5 | int main() {
| ^
|
s910234877
|
p04013
|
C++
|
a
|
a.cc:1:1: error: 'a' does not name a type
1 | a
| ^
|
s116292147
|
p04013
|
C++
|
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert
//{
inline 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();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
unsigned XorShift(void){static unsigned x = 123456789;static unsigned y = 362436069;static unsigned z = 521288629;static unsigned w = 88675123;unsigned t;t = x ^ (x << 11);x = y; y = z; z = w;return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));}
//}
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};
//}
int dp[55][55][3333];
main(){
int n,a;cin>>n>>a;int x[n];rep(i,n)cin>>x[i];
int dp[0][0][0]=1;
rep(i,n)rep(j,n)rep(k,2500){
dp[i+1][j][k]=dp[i][j][k];
dp[i+1][j+1][k+x[i]]=dp[i][j][k];
}
int ans=0;
for(int i=1;i<=n;i++){
ans+=dp[N][i][i*a];
}
dans;
}
|
a.cc:9:9: warning: "INT_MAX" redefined
9 | #define INT_MAX LLONG_MAX
| ^~~~~~~
In file included from /usr/include/c++/14/climits:42,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:38,
from a.cc:5:
/usr/lib/gcc/x86_64-linux-gnu/14/include/limits.h:120:9: note: this is the location of the previous definition
120 | #define INT_MAX __INT_MAX__
| ^~~~~~~
a.cc:53:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
53 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:55:25: error: array must be initialized with a brace-enclosed initializer
55 | int dp[0][0][0]=1;
| ^
a.cc:62:25: error: 'N' was not declared in this scope
62 | ans+=dp[N][i][i*a];
| ^
|
s660822560
|
p04013
|
C++
|
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int llint;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int n,a;
int x[50];
int sum = 0;
priority_queue<int> p;
int cnt = 0;
void dfs(int num, int sum){
if(num == n) return;
if(sum + x[num] == a) cnt++;
dfs(num+1,sum+x[i]);
dfs(num+1,sum);
return;
}
int main(){
cin >> n >> a;
for(int i = 0; i < n; i++) {
cin >> x[i];
x[i] -= a;
}
sort(x,x+n);
dfs(0,0);
cout << cnt << endl;
}
|
a.cc: In function 'void dfs(int, int)':
a.cc:23:21: error: 'i' was not declared in this scope
23 | dfs(num+1,sum+x[i]);
| ^
|
s691216156
|
p04013
|
C++
|
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
int main() {
int N, D;
cin >> N >> D;
vector<ll> A(N);
for(int i = 0; i < N; i++) cin >> A[i];
vector<vector<vector<ll>>> dp(N + 1, vector<vector<ll>(N + 1, vector<ll>(2501)));
dp[0][0][0] = 1;
for(int i = 0; i < N; i++) {
for(int j = 0; j <= N; j++) {
for(int k = 0; k <= 2500; k++) {
dp[i + 1][j][k] += dp[i][j][k];
dp[i + 1][j + 1][k + A[i]] += dp[i][j][k];
}
}
}
ll ans = 0;
for(int j = 1; j <= N; j++) {
for(int k = 0; k <= 2500; k++) {
if (j * D != k) continue;
ans += dp[N][j][k];
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:11:81: error: no matching function for call to 'std::vector<long long int>::vector(int, std::vector<long long int>)'
11 | vector<vector<vector<ll>>> dp(N + 1, vector<vector<ll>(N + 1, vector<ll>(2501)));
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = long long int; _Alloc = std::allocator<long long int>]'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed:
a.cc:11:81: note: deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<long long int>')
11 | vector<vector<vector<ll>>> dp(N + 1, vector<vector<ll>(N + 1, vector<ll>(2501)));
| ^
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; allocator_type = std::allocator<long long int>]'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<long long int>'
678 | vector(initializer_list<value_type> __l,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::__type_identity_t<_Alloc> = std::allocator<long long int>]'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<long long int>&&'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ~~~~~~~~~^~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = long long int; _Alloc = std::allocator<long long int>; allocator_type = std::allocator<long long int>; std::false_type = std::false_type]'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = long long int; _Alloc = std::allocator<long long int>; allocator_type = std::allocator<long long int>; std::true_type = std::true_type]'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::__type_identity_t<_Alloc> = std::allocator<long long int>]'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<long long int>&'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; size_type = long unsigned int; value_type = long long int; allocator_type = std::allocator<long long int>]'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'std::vector<long long int>' to 'const std::vector<long long int>::value_type&' {aka 'const long long int&'}
569 | vector(size_type __n, const value_type& __value,
| ~~~~~~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; size_type = long unsigned int; allocator_type = std::allocator<long long int>]'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'std::vector<long long int>' to 'const std::vector<long long int>::allocator_type&' {aka 'const std::allocator<long long int>&'}
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; allocator_type = std::allocator<long long int>]'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
a.cc:11:81: error: template argument 1 is invalid
11 | vector<vector<vector<ll>>> dp(N + 1, vector<vector<ll>(N + 1, vector<ll>(2501)));
| ^
a.cc:11:81: error: template argument 2 is invalid
|
s455914095
|
p04013
|
C++
|
#include <iostream>
#include <vector>
using namespace std;
int main() {
long long N, D;
cin >> N >> D;
vector<long long> A(N);
for(int i = 0; i < N; i++) {
cin >> A[i];
A[i] -= D;
}
vector<map<long long, long long>> dp(N + 1);
dp[0][0] = 1;
for(int i = 0; i < N; i++) {
for(auto e : dp[i]) {
long long j = e.first;
dp[i + 1][j] += dp[i][j];
dp[i + 1][j + A[i]] += dp[i][j];
}
}
cout << dp[N][0] - 1 << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:14:10: error: 'map' was not declared in this scope
14 | vector<map<long long, long long>> dp(N + 1);
| ^~~
a.cc:3:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
2 | #include <vector>
+++ |+#include <map>
3 |
a.cc:14:34: error: template argument 1 is invalid
14 | vector<map<long long, long long>> dp(N + 1);
| ^~
a.cc:14:34: error: template argument 2 is invalid
a.cc:15:5: error: invalid types 'int[int]' for array subscript
15 | dp[0][0] = 1;
| ^
a.cc:17:20: error: invalid types 'int[int]' for array subscript
17 | for(auto e : dp[i]) {
| ^
a.cc:19:9: error: invalid types 'int[int]' for array subscript
19 | dp[i + 1][j] += dp[i][j];
| ^
a.cc:19:25: error: invalid types 'int[int]' for array subscript
19 | dp[i + 1][j] += dp[i][j];
| ^
a.cc:20:9: error: invalid types 'int[int]' for array subscript
20 | dp[i + 1][j + A[i]] += dp[i][j];
| ^
a.cc:20:32: error: invalid types 'int[int]' for array subscript
20 | dp[i + 1][j + A[i]] += dp[i][j];
| ^
a.cc:23:13: error: invalid types 'int[long long int]' for array subscript
23 | cout << dp[N][0] - 1 << endl;
| ^
|
s579229104
|
p04013
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
int N,A;
cin >> N >> A;
vector<int> x(N);
for(int i=0;i<N;i++)cin >> x[i];
for(int i=0;i<N;i++)x[i]-=A;
|
a.cc: In function 'int main()':
a.cc:9:31: error: expected '}' at end of input
9 | for(int i=0;i<N;i++)x[i]-=A;
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s472633495
|
p04013
|
C++
|
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <climits>
using namespace std;
int main(){
ios::sync_with_stdio(false);
long long n,a,c=0;
cin >> n >> a;
vector<long long>x(n);
for(long long i=0;i<n;i++){
cin>>x[i];
}
sort(x.begin(),x.end());
long long max=max(x[n-1],a);
long long dp[50+10][50+10][2500+10];
memset(dp,0,sizeof(dp));
dp[0][0][0]=1;
for(long long j=1;j<=n;j++){
for(long long k=0;k<=n;k++){
for(long long s=0;s<=n*max;s++){
if(s<x[j-1])dp[j][k][s]+=dp[j-1][k][s];
else if(k>=1&&s>=x[j-1])dp[j][k][s]+=dp[j-1][k][s]+dp[j-1][k-1][s-x[j-1]];
else dp[j][k][s]=0;
}
}
}
for(long long j=1;j<=n;j++){
c+=dp[n][j][a*j];
}
cout<<c;
}
|
a.cc: In function 'int main()':
a.cc:20:22: error: 'max' cannot be used as a function
20 | long long max=max(x[n-1],a);
| ~~~^~~~~~~~~~
|
s098635939
|
p04013
|
C++
|
cin >> n >> a;
vector<int> x(n);
rep(i, n) cin >> x[i];
dp[0][0][0] = 1;
rep(i, n)rep(k, i+1)rep(j, 2501){
if(dp[i][k][j] > 0){
dp[i+1][k+1][j+x[i]] += dp[i][k][j];
dp[i+1][k][j] += dp[i][k][j];
}
}
LL ans = 0;
rep1(i, n+1){
rep(j, 2501){
if(j%i == 0 && j/i == a)
{
ans += dp[n][i][j];
}
}
}
cout << ans << endl;
}
|
a.cc:2:5: error: 'cin' does not name a type
2 | cin >> n >> a;
| ^~~
a.cc:3:5: error: 'vector' does not name a type
3 | vector<int> x(n);
| ^~~~~~
a.cc:4:8: error: expected constructor, destructor, or type conversion before '(' token
4 | rep(i, n) cin >> x[i];
| ^
a.cc:5:5: error: 'dp' does not name a type
5 | dp[0][0][0] = 1;
| ^~
a.cc:6:8: error: expected constructor, destructor, or type conversion before '(' token
6 | rep(i, n)rep(k, i+1)rep(j, 2501){
| ^
a.cc:12:5: error: 'LL' does not name a type
12 | LL ans = 0;
| ^~
a.cc:13:9: error: expected constructor, destructor, or type conversion before '(' token
13 | rep1(i, n+1){
| ^
a.cc:21:5: error: 'cout' does not name a type
21 | cout << ans << endl;
| ^~~~
a.cc:22:1: error: expected declaration before '}' token
22 | }
| ^
|
s500219982
|
p04013
|
C++
|
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstdio>
using namespace std;
long long dp[51][51][2500]; long long n, a, x[50];
int main() {
cin >> n >> a;
for (int i = 0; i < n; i++)cin >> x[i];
dp[0][0][0] = 1;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
for (int k = 0; k < 2500; k++) {
if (dp[i][j][k] == 0)continue;
dp[i + 1][j+1][k + x[i]] += dp[i][j][k];
dp[i + 1][j][k] += dp[i][j][k];
}
}
}
long long sum = 0;
for (int i = 1; i <= n; i++)sum += dp[n][i][a*i];
cout << sum << endl;
}
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstdio>
using namespace std;
long long dp[51][51][2500]; long long n, a, x[50];
int main() {
cin >> n >> a;
for (int i = 0; i < n; i++)cin >> x[i];
dp[0][0][0] = 1;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
for (int k = 0; k < 2500; k++) {
if (dp[i][j][k] == 0)continue;
dp[i + 1][j+1][k + x[i]] += dp[i][j][k];
dp[i + 1][j][k] += dp[i][j][k];
}
}
}
long long sum = 0;
for (int i = 1; i <= n; i++)sum += dp[n][i][a*i];
cout << sum << endl;
}
|
a.cc:35:11: error: redefinition of 'long long int dp [51][51][2500]'
35 | long long dp[51][51][2500]; long long n, a, x[50];
| ^~
a.cc:9:11: note: 'long long int dp [51][51][2500]' previously declared here
9 | long long dp[51][51][2500]; long long n, a, x[50];
| ^~
a.cc:35:39: error: redefinition of 'long long int n'
35 | long long dp[51][51][2500]; long long n, a, x[50];
| ^
a.cc:9:39: note: 'long long int n' previously declared here
9 | long long dp[51][51][2500]; long long n, a, x[50];
| ^
a.cc:35:42: error: redefinition of 'long long int a'
35 | long long dp[51][51][2500]; long long n, a, x[50];
| ^
a.cc:9:42: note: 'long long int a' previously declared here
9 | long long dp[51][51][2500]; long long n, a, x[50];
| ^
a.cc:35:45: error: redefinition of 'long long int x [50]'
35 | long long dp[51][51][2500]; long long n, a, x[50];
| ^
a.cc:9:45: note: 'long long int x [50]' previously declared here
9 | long long dp[51][51][2500]; long long n, a, x[50];
| ^
a.cc:36:5: error: redefinition of 'int main()'
36 | int main() {
| ^~~~
a.cc:10:5: note: 'int main()' previously defined here
10 | int main() {
| ^~~~
|
s621438465
|
p04013
|
C++
|
#include<bits/stdc++.h>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
ll bpow(ll,ll,ll);
typedef vector<int> vec;
typedef vector<vec> mat;
mat mul(mat &A,mat &B);
mat pow(mat A,ll n);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
const int MOD = 1000000007;
ll dp[51][51][2600] = {0};
bool cmp_P(const P &a,const P &b){
return a.second < b.second;
}
int main()
{
ll sum,N,A,x[51];
cin >> N >> A;
REP(i,N)cin >> x[i+1];
REP(i,51)REP(j,51)REP(k,2600)dp[i][j][k] = 0;
dp[0][0][0] = 1;
for(int i=1;i<=N;i++){
for(int j=0;j<=N;j++){
for(int k=0;k<2500;k++){
if(k-x[i] >= 0 && j-1 >= 0)
dp[i][j][k] = dp[i-1][j-1][k-x[i]] + dp[i-1][j][k];
else
dp[i][j][k] = dp[i-1][j][k];
}
}
}
for(LL j=1;A*j<=2599;j++)
sum += dp[N][j][A*j];
cout << sum << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:43:7: error: 'LL' was not declared in this scope; did you mean 'll'?
43 | for(LL j=1;A*j<=2599;j++)
| ^~
| ll
a.cc:43:16: error: 'j' was not declared in this scope
43 | for(LL j=1;A*j<=2599;j++)
| ^
|
s877659001
|
p04013
|
C++
|
# encoding: utf-8
N, A = map(int, input().split())
x = list(map(int, input().split()))
MAX_X = 50
x.sort()
memo = [None] * (N * N * MAX_X * N)
def get(pos, tmp, cnt):
# print("#", pos, tmp, cnt)
# end
if pos == N:
if cnt > 0 and cnt * A == tmp:
# print("##", pos, tmp, cnt, "end\tret=", 1)
return 1
else: return 0
# read memo
idx_memo = pos * (N * N * MAX_X) + cnt * (N * MAX_X) + tmp
if memo[idx_memo] != None:
# print("##", pos, tmp, cnt, "memo\tret=", memo[idx_memo])
return memo[idx_memo]
for cnt_sub in range(1, cnt):
if tmp % cnt > 0: break
tmp_sub = (tmp // cnt) * cnt_sub
idx_memo = pos * (N * N * MAX_X) + cnt_sub * (N * MAX_X) + tmp_sub
if memo[idx_memo] != None:
# print("##", pos, tmp, cnt, "sub\tret=", memo[idx_memo])
return memo[idx_memo]
# process
ret = 0
ret += get(pos + 1, tmp + x[pos], cnt + 1) # take
ret += get(pos + 1, tmp, cnt) # pass
# write memo
idx_memo = pos * (N * N * MAX_X) + cnt * (N * MAX_X) + tmp
if memo[idx_memo] == None: memo[idx_memo] = ret
# for cnt_sub in range(1, cnt):
# if tmp % cnt > 0: break
# tmp_sub = (tmp // cnt) * cnt_sub
# idx_memo = pos * (N * N * MAX_X) + cnt_sub * (N * MAX_X) + tmp_sub
# if memo[idx_memo] == None: memo[idx_memo] = ret
return ret
print(get(0, 0, 0))
|
a.cc:1:3: error: invalid preprocessing directive #encoding
1 | # encoding: utf-8
| ^~~~~~~~
a.cc:11:7: error: invalid preprocessing directive #print
11 | # print("#", pos, tmp, cnt)
| ^~~~~
a.cc:12:7: error: invalid preprocessing directive #end; did you mean #endif?
12 | # end
| ^~~
| endif
a.cc:15:15: error: invalid preprocessing directive #print
15 | # print("##", pos, tmp, cnt, "end\tret=", 1)
| ^~~~~
a.cc:18:7: error: invalid preprocessing directive #read
18 | # read memo
| ^~~~
a.cc:21:11: error: invalid preprocessing directive #print
21 | # print("##", pos, tmp, cnt, "memo\tret=", memo[idx_memo])
| ^~~~~
a.cc:28:15: error: invalid preprocessing directive #print
28 | # print("##", pos, tmp, cnt, "sub\tret=", memo[idx_memo])
| ^~~~~
a.cc:30:7: error: invalid preprocessing directive #process
30 | # process
| ^~~~~~~
a.cc:32:48: error: stray '#' in program
32 | ret += get(pos + 1, tmp + x[pos], cnt + 1) # take
| ^
a.cc:33:35: error: stray '#' in program
33 | ret += get(pos + 1, tmp, cnt) # pass
| ^
a.cc:34:7: error: invalid preprocessing directive #write
34 | # write memo
| ^~~~~
a.cc:37:7: error: invalid preprocessing directive #for
37 | # for cnt_sub in range(1, cnt):
| ^~~
a.cc:38:18: error: division by zero in #if
38 | # if tmp % cnt > 0: break
| ^
a.cc:38:27: error: ':' without preceding '?'
38 | # if tmp % cnt > 0: break
| ^
a.cc:41: error: unterminated #if
41 | # if memo[idx_memo] == None: memo[idx_memo] = ret
a.cc:38: error: unterminated #if
38 | # if tmp % cnt > 0: break
a.cc:2:1: error: 'N' does not name a type
2 | N, A = map(int, input().split())
| ^
|
s776127424
|
p04013
|
C++
|
#define _CRT_SECURE_NO_WARNINGS
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#include <utility>
#include <assert.h>
using namespace std;
typedef uint64_t uint;
typedef int64_t sint;
int main(int argc, char* argv[])
{
for (;;) {
uint N, A;
cin >> N >> A;
if (cin.fail()) break;
std::vector<uint> xx;
for (uint i = 0; i < N; i++) {
uint x;
cin >> x;
xx.push_back(x);
}
map<uint, map<uint, uint>> m; // <sum, <div, count>>
m[0][0] = 1;
for (uint x : xx) {
auto old_m = m;
for (auto& e1 : old_m) {
for (auto& e2 : e1.second) {
m[e1.first + x][e2.first + 1] += e2.second;
}
}
}
uint result = 0;
for (auto& e1 : m) {
for (auto& e2 : e1.second) {
if (e2.first > 0 && e1.first % e2.first == 0 && e1.first / e2.first == A) {
result += e2.second;
}
}
}
printf("%I64d\n", result);
}
return 0;
}
|
a.cc:17:9: error: 'uint64_t' does not name a type
17 | typedef uint64_t uint;
| ^~~~~~~~
a.cc:15:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
14 | #include <assert.h>
+++ |+#include <cstdint>
15 | using namespace std;
|
s022606089
|
p04013
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(){
int dp[60][60][3000]; //i番目までの中からj個選んで総和になりうるか
int N,A;
cin>>N>>A;
int x[N+1];
for(int i=0; i<N; i++){
cin>>x[i];
}
dp[0][0][0]=1;
for(int i=0; i<N; i++){
for(int j=0; j<=N; j++){
for(int k=0; k<=A*N; k++){
dp[i+1][jA+1][k+x[i]]+=dp[i][j][k];
dp[i+1][j][k]+=dp[i][j][k];
}
}
}
int sum = 0;
for (int i = 0; i <= N; i++){
sum += dp[N][i][A*i];
}
cout << sum-1 << endl;
}
|
a.cc: In function 'int main()':
a.cc:15:17: error: 'jA' was not declared in this scope; did you mean 'j'?
15 | dp[i+1][jA+1][k+x[i]]+=dp[i][j][k];
| ^~
| j
|
s831869847
|
p04013
|
C++
|
#include<iostream>
#include<cstdio>
#include<cstdlib>
#define re register
#define N 55
#define LL long long
using namespace std;
int n,A,a[N];
LL f[N][N][N*N],ans=0;
int main(){
scanf("%d%d",&n,&A);
for(re int i=1;i<=n;++i) scanf("%d",&a[i]);
memset(f,0,sizeof(f)); f[0][0][0]=1ll;
for(re int i=0;i<=n;++i){
for(re int j=0;j<=i;++j){
for(re int k=0;k<=2500;++k){
if(f[i][j][k]){
f[i+1][j+1][k+a[i+1]]+=f[i][j][k];
f[i+1][j][k]+=f[i][j][k];
}
}
}
}
for(re int i=1;i<=n;++i) if(f[n][i][i*A]) ans+=f[n][i][i*A];
printf("%lld\n",ans);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
12 | for(re int i=1;i<=n;++i) scanf("%d",&a[i]);
| ^
a.cc:13:9: error: 'memset' was not declared in this scope
13 | memset(f,0,sizeof(f)); f[0][0][0]=1ll;
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<cstdlib>
+++ |+#include <cstring>
4 | #define re register
a.cc:14:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
14 | for(re int i=0;i<=n;++i){
| ^
a.cc:15:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
15 | for(re int j=0;j<=i;++j){
| ^
a.cc:16:36: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
16 | for(re int k=0;k<=2500;++k){
| ^
a.cc:24:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
24 | for(re int i=1;i<=n;++i) if(f[n][i][i*A]) ans+=f[n][i][i*A];
| ^
|
s523155719
|
p04013
|
C++
|
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
typedef vector<long long> vll, vLL;
bool check(const string& s,const string& t){
int n = s.size();
int m = t.size();
for(int i=0;i<=n-m;i++){
bool ok = true;
REP(j,m){
if(s[i+j]!='?' && s[i+j]!=t[j])ok=false;
}
if(ok)return true;
}
return false;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n,a,x[51],y[51],maxX;
ll dp[51][5001];
scanf("%d %d",&n,&a);
maxX = a;
REP(i,n){
scanf("%d",&x[i+1]);
maxX = max(x[i+1],maxX);
}
memset(dp,0,sizeof(dp));
REP(j,n){
y[j+1] = x[j+1] - a;
}
dp[0][n*maxX]=1;
for(int j = 1;j<=n;j++){
REP(t,2*n*maxX + 1){
dp[j][t] = dp[j-1][t];
if(t>=y[j] && t-y[j]<=2*n*maxX){
dp[j][t] += dp[j-1][t-y[j]];
//if(dp[j][t]>0)cout << "if dp[" << j-1 << "][" << t << "]+dp[" << j-1 << "][" << t-y[j] << "]=dp[" << j << "][" << t << "]=" << dp[j][t] << endl;
}else{
//if(dp[j][t]>0)cout << "else dp[" << j-1 << "][" << t << "]=dp[" << j << "][" << t << "]=" << dp[j][t] << endl;
}
}
}
cout << dp[n][n*maxX]-1 << endl;
return 0;
}
/*int A[100100];
long long dp[100][3000];
int main3(){
int n,x,a;
cin >> n >> x;
for(int i=0;i<n;i++){
cin >> A[i];
A[i]-=x;
}
dp[0][n*x]=1;
for(int i=0;i<n;i++){
for(int j=0;j<=50*50;j++){
dp[i+1][j]=dp[i][j];
if(j-A[i]>=0)
dp[i+1][j]+=dp[i][j-A[i]];
cout << "dp[" << i+1 << "][" << j << "]=" << dp[i+1][j] << endl;
}
}
cout << dp[n][n*x]-1 << endl;
return 0;
}*/
|
a.cc: In function 'int main()':
a.cc:37:9: error: 'memset' was not declared in this scope
37 | memset(dp,0,sizeof(dp));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <functional>
+++ |+#include <cstring>
4 | #include <string>
|
s552779167
|
p04013
|
C++
|
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
typedef vector<long long> vll, vLL;
bool check(const string& s,const string& t){
int n = s.size();
int m = t.size();
for(int i=0;i<=n-m;i++){
bool ok = true;
REP(j,m){
if(s[i+j]!='?' && s[i+j]!=t[j])ok=false;
}
if(ok)return true;
}
return false;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n,a,x[51],y[51],maxX;
ll dp[51][5001];
scanf("%d %d",&n,&a);
maxX = a;
REP(i,n){
scanf("%d",&x[i+1]);
maxX = max(x[i+1],maxX);
}
memset(dp,0,sizeof(dp));
REP(j,n){
y[j+1] = x[j+1] - a;
}
dp[0][n*maxX]=1;
for(int j = 1;j<=n;j++){
REP(t,2*n*maxX + 1){
dp[j][t] = dp[j-1][t];
if(t>=y[j] && t-y[j]<=2*n*maxX){
dp[j][t] += dp[j-1][t-y[j]];
//if(dp[j][t]>0)cout << "if dp[" << j-1 << "][" << t << "]+dp[" << j-1 << "][" << t-y[j] << "]=dp[" << j << "][" << t << "]=" << dp[j][t] << endl;
}else{
//if(dp[j][t]>0)cout << "else dp[" << j-1 << "][" << t << "]=dp[" << j << "][" << t << "]=" << dp[j][t] << endl;
}
}
}
cout << dp[n][n*maxX]-1 << endl;
return 0;
}
/*int A[100100];
long long dp[100][3000];
int main3(){
int n,x,a;
cin >> n >> x;
for(int i=0;i<n;i++){
cin >> A[i];
A[i]-=x;
}
dp[0][n*x]=1;
for(int i=0;i<n;i++){
for(int j=0;j<=50*50;j++){
dp[i+1][j]=dp[i][j];
if(j-A[i]>=0)
dp[i+1][j]+=dp[i][j-A[i]];
cout << "dp[" << i+1 << "][" << j << "]=" << dp[i+1][j] << endl;
}
}
cout << dp[n][n*x]-1 << endl;
return 0;
}*/
|
a.cc: In function 'int main()':
a.cc:37:9: error: 'memset' was not declared in this scope
37 | memset(dp,0,sizeof(dp));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <functional>
+++ |+#include <cstring>
4 | #include <string>
|
s750690522
|
p04013
|
C++
|
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
typedef vector<long long> vll, vLL;
bool check(const string& s,const string& t){
int n = s.size();
int m = t.size();
for(int i=0;i<=n-m;i++){
bool ok = true;
REP(j,m){
if(s[i+j]!='?' && s[i+j]!=t[j])ok=false;
}
if(ok)return true;
}
return false;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n,a,x[51],y[51],maxX;
ll dp[51][5001];
scanf("%d %d",&n,&a);
maxX = a;
REP(i,n){
scanf("%d",&x[i+1]);
maxX = max(x[i+1],maxX);
}
memset(dp,0,sizeof(dp));
REP(j,n){
y[j+1] = x[j+1] - a;
}
dp[0][n*maxX]=1;
for(int j = 1;j<=n;j++){
REP(t,2*n*maxX + 1){
dp[j][t] = dp[j-1][t];
if(t>=y[j] && t-y[j]<=2*n*maxX){
dp[j][t] += dp[j-1][t-y[j]];
//if(dp[j][t]>0)cout << "if dp[" << j-1 << "][" << t << "]+dp[" << j-1 << "][" << t-y[j] << "]=dp[" << j << "][" << t << "]=" << dp[j][t] << endl;
}else{
//if(dp[j][t]>0)cout << "else dp[" << j-1 << "][" << t << "]=dp[" << j << "][" << t << "]=" << dp[j][t] << endl;
}
}
}
cout << dp[n][n*maxX]-1 << endl;
return 0;
}
/*int A[100100];
long long dp[100][3000];
int main3(){
int n,x,a;
cin >> n >> x;
for(int i=0;i<n;i++){
cin >> A[i];
A[i]-=x;
}
dp[0][n*x]=1;
for(int i=0;i<n;i++){
for(int j=0;j<=50*50;j++){
dp[i+1][j]=dp[i][j];
if(j-A[i]>=0)
dp[i+1][j]+=dp[i][j-A[i]];
cout << "dp[" << i+1 << "][" << j << "]=" << dp[i+1][j] << endl;
}
}
cout << dp[n][n*x]-1 << endl;
return 0;
}*/
|
a.cc: In function 'int main()':
a.cc:37:9: error: 'memset' was not declared in this scope
37 | memset(dp,0,sizeof(dp));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <functional>
+++ |+#include <cstring>
4 | #include <string>
|
s202847734
|
p04013
|
C++
|
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
typedef vector<long long> vll, vLL;
bool check(const string& s,const string& t){
int n = s.size();
int m = t.size();
for(int i=0;i<=n-m;i++){
bool ok = true;
REP(j,m){
if(s[i+j]!='?' && s[i+j]!=t[j])ok=false;
}
if(ok)return true;
}
return false;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n,a,x[60],y[60];
scanf("%d %d",&n,&a);
REP(i,n){
scanf("%d",&x[i]);
}
ll dp[50][2500];
memset(dp,0,sizeof(dp));
REP(j,n){
y[j] = x[j] - a;
}
dp[0][n*a]=1;
REP(i,n){
for(int k=0;k<=n*a;k++){
dp[i+1][k] = dp[i][k];
if(k>=y[i]&&k-y[i]<=2*n*a)dp[i+1][k] += dp[i][k-y[i]];
}
}
cout << dp[n][n*a]-1 << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:35:9: error: 'memset' was not declared in this scope
35 | memset(dp,0,sizeof(dp));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <functional>
+++ |+#include <cstring>
4 | #include <string>
|
s198667228
|
p04013
|
C++
|
include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <utility>
#include <map>
#include <inttypes.h>
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
#define INF 1<<21
using pii = std::pair<int, int>;
#define SORT(v) std::sort(v.begin(), v.end())
int main(){
int N,A,max;
std::cin >> N >> A;
max = A;
std::vector<int> x(N);
for (int i = 0; i < N; i++) {
std::cin >> x[i];
max = std::max(max, x[i]);
}
std::vector<std::vector<std::vector<long long >>>dp(N + 5, std::vector<std::vector<long long>>(N + 5, std::vector<long long>(N*A + 5, 0)));
for (int i = 0; i <= N; i++) {
for (int j = 0; j <= N; j++) {
for (int k = 0; k <= N*max; k++) {
if (i == 0 && j == 0 && k == 0) {
dp[i][j][k] = 1;
}
else if (i>=1&&k < x[i]) {
dp[i][j][k] = dp[i - 1][j][k];
}
else if (i >= 1 && j >= 1 && k >= x[i-1]) {
dp[i][j][k] = dp[i - 1][j][k]+dp[i-1][j-1][k-x[i-1]];
}
else {
dp[i][j][k] = 0;
}
}
}
}
long sum = 0;
for (int i = 1; i <= N; i++) {
sum += dp[N][i][i*A];
}
std::cout << sum << std::endl;
return 0;
}
|
a.cc:1:1: error: 'include' does not name a type
1 | include <iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/vector:62,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
|
|
s612823647
|
p04013
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int N,A,K,x[210000000];
int f[210000000],a[210000000];
int ans=0;
void dfs(int dep)
{
if(dep==K+1)
{
int sum=0;
for(int i=1;i<=K;i++)
{
sum+=x[a[i]];
}
if(sum==K*A)
{
ans++;
}
}
else
{
for(int i=1;i<=N;i++)
{
if(f[i]==0&&a[dep-1]<i)
{
f[i]=1;
a[dep]=i;
dfs(dep++);
f[i]=0;
}
}
}
}
int main()
{
cin>>N>>A;
for(int i=1;i<=N;i++)
{
cin>>x[i];
}
for(int i=1;i<=N;i++)
{
K=i;
dfs(1);
}
cout<<ans<<endl;
}
|
/tmp/ccP6qeX0.o: in function `dfs(int)':
a.cc:(.text+0x80): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccP6qeX0.o
a.cc:(.text+0x89): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccP6qeX0.o
/tmp/ccP6qeX0.o: in function `main':
a.cc:(.text+0x1f2): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccP6qeX0.o
collect2: error: ld returned 1 exit status
|
s441572318
|
p04013
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int n,a,k,x[17];
bool f[17];
int sum=0;
void dfs(int dep)
{
if(dep==k+1)
int ans=0;
for(int i=1;i<=k;i++)
{
ans+=x[a[i]];
}
if(ans==k*a) sum++;
else
{
for(int j=i;j<=n;j++)
{
if(f[i]==0&&a[dep-1]<i)
{
a[dep]=i;
f[i]=1;
dfs(dep+1);
f[i]=0;
}
}
}
}
int main()
{
int n,a,x[16];
cin>>n>>a;
cin>>x;
for(int i=1;i<=n;i++)
{
k=i;
dfs(1);
}
cout<<sum;
return 0;
}
|
a.cc: In function 'void dfs(int)':
a.cc:12:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
12 | ans+=x[a[i]];
| ^~~
| abs
a.cc:12:25: error: invalid types 'int[int]' for array subscript
12 | ans+=x[a[i]];
| ^
a.cc:14:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
14 | if(ans==k*a) sum++;
| ^~~
| abs
a.cc:17:27: error: 'i' was not declared in this scope
17 | for(int j=i;j<=n;j++)
| ^
a.cc:19:38: error: invalid types 'int[int]' for array subscript
19 | if(f[i]==0&&a[dep-1]<i)
| ^
a.cc:21:34: error: invalid types 'int[int]' for array subscript
21 | a[dep]=i;
| ^
a.cc: In function 'int main()':
a.cc:33:12: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int [16]')
33 | cin>>x;
| ~~~^~~
| | |
| | int [16]
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:14: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int*'
33 | cin>>x;
| ^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:14: error: invalid conversion from 'int*' to 'short int' [-fpermissive]
33 | cin>>x;
| ^
| |
| int*
a.cc:33:14: error: cannot bind rvalue '(short int)((int*)(& x))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:14: error: invalid conversion from 'int*' to 'short unsigned int' [-fpermissive]
33 | cin>>x;
| ^
| |
| int*
a.cc:33:14: error: cannot bind rvalue '(short unsigned int)((int*)(& x))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:14: error: invalid conversion from 'int*' to 'int' [-fpermissive]
33 | cin>>x;
| ^
| |
| int*
a.cc:33:14: error: cannot bind rvalue '(int)((int*)(& x))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:14: error: invalid conversion from 'int*' to 'unsigned int' [-fpermissive]
33 | cin>>x;
| ^
| |
| int*
a.cc:33:14: error: cannot bind rvalue '(unsigned int)((int*)(& x))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:14: error: invalid conversion from 'int*' to 'long int' [-fpermissive]
33 | cin>>x;
| ^
| |
| int*
a.cc:33:14: error: cannot bind rvalue '(long int)((int*)(& x))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:14: error: invalid conversion from 'int*' to 'long unsigned int' [-fpermissive]
33 | cin>>x;
| ^
| |
| int*
a.cc:33:14: error: cannot bind rvalue '(long unsigned int)((int*)(& x))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:14: error: invalid conversion from 'int*' to 'long long int' [-fpermissive]
33 | cin>>x;
| ^
| |
| int*
a.cc:33:14: error: cannot bind rvalue '(long long int)((int*)(& x))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:14: error: invalid conversion from 'int*' to 'long long unsigned int' [-fpermissive]
33 | cin>>x;
| ^
| |
| int*
a.cc:33:14: error: cannot bind rvalue '(long long unsigned int)((int*)(& x))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:14: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
33 | cin>>x;
| ^
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'int [16]' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'int [16]' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'int [16]' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'int [16]' to 'std::basic_istr
|
s366108961
|
p04013
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
ll dp[51][2501];
int main(){
int n, a;
cin >> n >> a;
vector<int> x[n];
REP(i, n) cin >> x[i];
dp[0][0] = 1;
REP(i, n){
REPR(j, n){
REP(k, 2501 - x[i]){
dp[j + 1][k + x[i]] += dp[j][k];
}
}
}
ll ans = 0;
REP(i, n + 1) ans += dp[i + 1][(i + 1) * a];
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:18:17: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<int>')
18 | REP(i, n) cin >> x[i];
| ~~~ ^~ ~~~~
| | |
| | std::vector<int>
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool&'
170 | operator>>(bool& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]'
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int&'
174 | operator>>(short& __n);
| ~~~~~~~^~~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int&'
177 | operator>>(unsigned short& __n)
| ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]'
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'int&'
181 | operator>>(int& __n);
| ~~~~~^~~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int&'
184 | operator>>(unsigned int& __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int&'
188 | operator>>(long& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int&'
192 | operator>>(unsigned long& __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int&'
199 | operator>>(long long& __n)
| ~~~~~~~~~~~^~~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int&'
203 | operator>>(unsigned long long& __n)
| ~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<int>' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<int>' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'void*&'
328 | operator>>(void*& __p)
| ~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]'
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ^~~~~~~~
/usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]'
352 | operator>>(__streambuf_type* __sb);
| ^~~~~~~~
/usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'}
352 | operator>>(__streambuf_type* __sb);
| ~~~~~~~~~~~~~~~~~~^~~~
In file included from /usr/include/x86_64-linu
|
s005463684
|
p04013
|
C++
|
//
// Created by 童正阳 on 2018/9/14.
// https://abc044.contest.atcoder.jp/tasks/arc060_a
// 动态规划:dp[i][j]表示选i个数和为j的方法数
// 那么有:dp[i][j]=\sum{dp[i-1][j-a[k]], 1<=k<=N}
// 最终结果为:\sum{dp[i][i*A]}
//
#include <iostream>
using namespace std;
typedef long long ll;
int N, A, x[51], sum[51];
ll dp[51][2501];
int main() {
cin >> N >> A;
memset(sum, 0, sizeof(sum));
for (int i = 1; i <= N; i++) {
cin >> x[i];
sum[i] = sum[i-1] + x[i];
}
memset(dp, 0, sizeof(dp));
dp[0][0] = 1;
for (int k = 1; k <= N; k++) {
for (int i = k; i >= 1; i--) {
for (int j = sum[k]; j >= x[k]; j--) {
dp[i][j] += dp[i-1][j-x[k]];
}
}
}
ll ans = 0;
for (int i = 1; i <= N; i++) {
ans += dp[i][i*A];
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:15:5: error: 'memset' was not declared in this scope
15 | memset(sum, 0, sizeof(sum));
| ^~~~~~
a.cc:9:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
8 | #include <iostream>
+++ |+#include <cstring>
9 | using namespace std;
|
s510671866
|
p04013
|
C++
|
#include <iostream>
using namespace std;
int main(){
long long n,a;
cin >> n >> a;
long long x[n];
for (int i=0; i<n; i++){
cin >> x[i];
x[i]-=a;
}
if (n>=17){
long long dp[n][100*n+1]={{0,0}};
dp[0][x[0]+50*n]=1;
dp[0][50*n]+=1;
for (int i=1; i<n; i++){
for (int j=0; j<=100*n; j++){
if (j>=x[i] && j-x[i]<=100*n){
dp[i][j]=dp[i-1][j]+dp[i-1][j-x[i]];
}
else{
dp[i][j]=dp[i-1][j];
}
}
}
cout << dp[n-1][50*n]-1<<endl;
}
else {
for (int i=1; i< (1<<n); i++){
int sum=0;
for (int j=0; j<n; j++){
if (i>>j & 1){
sum+=x[j];
}
}
if (sum==0){
ans++;
}
}
cout << ans <<endl;
}
}
|
a.cc: In function 'int main()':
a.cc:38:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
38 | ans++;
| ^~~
| abs
a.cc:41:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
41 | cout << ans <<endl;
| ^~~
| abs
|
s884549868
|
p04013
|
Java
|
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Scanner;
public class Abc044c2 {
public static void main(String args[]) {
@SuppressWarnings("resource")
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int a = scanner.nextInt();
List<Integer> x = new ArrayList<>();
for (int i = 0; i < n; i++) {
int tmp = scanner.nextInt();
x.add(tmp - a);
}
HashMap<Integer,Long> mapa=new HashMap<Integer,Long>();
HashMap<Integer,Long> mapb=new HashMap<Integer,Long>();
mapa.put(0,1L);
mapb.put(0, 1L);
for (Integer num : x) {
for (Entry<Integer, Long> entry : mapb.entrySet()) {
int sum = entry.getKey() + num;
long way = entry.getValue();
if(mapa.containsKey(sum)){
mapa.put(sum, mapa.get(sum) + way);
}else{
mapa.put(sum, way);
}
}
mapb.clear();
mapb.putAll(mapa);
}
System.out.println(mapb.get(0)-1);
}
}
|
Main.java:7: error: class Abc044c2 is public, should be declared in a file named Abc044c2.java
public class Abc044c2 {
^
1 error
|
s685344354
|
p04013
|
C++
|
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include<algorithm>
#include <numeric>
using namespace std;
int main(){
int N ,A;
cin >> N >>A;
int x[N];
for(int i=1;i<N+1;i++){
cin >> x[i];
}
long long dp[51][2501][51]={};
dp[0][0][0]=1;
for(int i=1;i<N+1;i++){
for(int j=0;j<K;j++){
for(int k=0;k<N+1;k++){
if(k<1 || j<x[i]){
dp[i][j][k]=dp[i-1][j][k];
}else{
dp[i][j][k]=dp[i-1][j][k]+dp[i-1][j-x[i]][k-1];
}
}
}
}
long long ans=0;
for(int i=1; i<=N; i++){
ans+=dp[N][i*A][i];
}
cout << ans << endl;
return 0;}
|
a.cc: In function 'int main()':
a.cc:19:22: error: 'K' was not declared in this scope
19 | for(int j=0;j<K;j++){
| ^
|
s895677767
|
p04013
|
C++
|
from itertools import product
N, A = map(int, input().split())
x = [int(xi) for xi in input().split()]
x_max = max(max(x), A)
dp = [[[0 for _ in range((N + 1) * x_max)]
for _ in range(N + 1)]
for _ in range(N + 1)]
dp[0][0][0] = 1
for j, k, s in product(range(1, N + 1),
range(N + 1),
range((N + 1) * x_max)):
if s < x[j - 1]:
dp[j][k][s] = dp[j - 1][k][s]
elif k >= 1 and s >= x[j - 1]:
dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - x[j - 1]]
answer = sum([dp[N][k][k*A] for k in range(1, N + 1)])
print(answer)
|
a.cc:1:1: error: 'from' does not name a type
1 | from itertools import product
| ^~~~
|
s996846390
|
p04013
|
C++
|
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
// 今,選んだ枚数,合計
long long dp[][51][2501];
int main()
{
int n, a, x[50];
cin >> n >> a;
for (int i = 0; i < n; i++)
cin >> x[i];
dp[0][0][0] = 1;
dp[0][1][x[0]] = 1;
for (int i = 1; i < n; i++)
for (int j = 0; j < n + 1; j++)
for (int k = 0; k < 251; k++)
dp[i][j][k] = dp[i - 1][j][k] + (j == 0 || k - x[i] < 0 ? 0 : dp[i - 1][j - 1][k - x[i]]);
long long ans = 0;
for (int i = 1; i < n + 1; i++)
ans += dp[n - 1][i][i * a];
cout << ans << endl;
return 0;
}
|
a.cc:7:11: error: storage size of 'dp' isn't known
7 | long long dp[][51][2501];
| ^~
|
s320371095
|
p04013
|
C++
|
#!/usr/bin/env python
N, A = map(int, raw_input().split())
x = map(int, raw_input().split())
DP =[[0 for i in range(N * 50 + 1)] for j in range(N + 1)]
DP[0][0] = 1
for i in range(N):
for j in range(N, 0, -1):
for k in range(x[i], N * 50 + 1):
DP[j][k] += DP[j - 1][k - x[i]]
ans = 0
for i in range(1, N + 1):
ans += DP[i][i * A]
print ans
|
a.cc:1:2: error: invalid preprocessing directive #!
1 | #!/usr/bin/env python
| ^
a.cc:2:1: error: 'N' does not name a type
2 | N, A = map(int, raw_input().split())
| ^
|
s333058005
|
p04013
|
C++
|
#include <iostream>
#include <math.h>
using namespace std;
const int Nmax = 50;
const int Amax = 50;
const int Xmax = 50;
long dp[Nmax+1][Nmax+1][Nmax*Xmax+1] = {};
long xarr[Xmax];
int main()
{
long N,A;
cin >> N >> A;
for (int i = 0; i < N; i++) cin >> xarr[i];
// end input
long m = (long)max(A, *max_element(xarr, xarr+N));
for (int j = 0; j <= N; j++) {
for (int k = 0; k <= N; k++) {
for (int s = 0; s <= m*N; s++) {
long tmp = 0;
if (j == 0 && k == 0 && s == 0) { tmp = 1; }
else if (j >= 1 && s < xarr[j-1]) { tmp = dp[j-1][k][s]; }
else if (j >= 1 && k >= 1 && s >= xarr[j-1]) {
tmp = dp[j-1][k][s] + dp[j-1][k-1][s-xarr[j-1]];
}
dp[j][k][s] = tmp;
}
}
}
long sum = 0;
for (int i = 1; i <= N; i++) sum += dp[N][i][i*A];
cout << sum << "\n=="<<endl;
// for (int i = 0; i < m*N; i++) cout << dp[N-1][i][i*A] << endl;
}
|
a.cc: In function 'int main()':
a.cc:20:26: error: 'max_element' was not declared in this scope
20 | long m = (long)max(A, *max_element(xarr, xarr+N));
| ^~~~~~~~~~~
|
s362048958
|
p04013
|
C++
|
#include <iostream>
#include <math.h>
using namespace std;
const int Nmax = 50;
const int Amax = 50;
const int Xmax = 50;
long dp[Nmax+1][Nmax+1][Nmax*Xmax+1] = {};
long xarr[Xmax];
int main()
{
long N,A;
cin >> N >> A;
for (int i = 0; i < N; i++) cin >> xarr[i];
// end input
long m = (long)max(A, *max_element(xarr, xarr+N));
for (int j = 0; j <= N; j++) {
for (int k = 0; k <= N; k++) {
for (int s = 0; s <= m*N; s++) {
long tmp = 0;
if (j == 0 && k == 0 && s == 0) { tmp = 1; }
else if (j >= 1 && s < xarr[j-1]) { tmp = dp[j-1][k][s]; }
else if (j >= 1 && k >= 1 && s >= xarr[j-1]) {
tmp = dp[j-1][k][s] + dp[j-1][k-1][s-xarr[j-1]];
}
dp[j][k][s] = tmp;
}
}
}
long sum = 0;
for (int i = 1; i <= N; i++) sum += dp[N][i][i*A];
cout << sum << "\n=="<<endl;
// for (int i = 0; i < m*N; i++) cout << dp[N-1][i][i*A] << endl;
}
|
a.cc: In function 'int main()':
a.cc:20:26: error: 'max_element' was not declared in this scope
20 | long m = (long)max(A, *max_element(xarr, xarr+N));
| ^~~~~~~~~~~
|
s156010952
|
p04013
|
C++
|
#include <stdio.h>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <iostream>
using namespace std;
#define Vi vector<int>
#define ll long long
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i=0;i<n;++i)
int main()
{
int n,a;
cin>>n>>a;
vector<ll>x(n);
vector<ll>y(n);
rep(i,n){
cin>>x[i];
y[i]=x[i]-a;
}
Sort(x);
ll X=x[x.size()-1];
vector<vector<ll>> dp(n+2,vector<ll>(2*n*X+5));
rep(i,n+2){
rep(j,2*n*X+5){
dp[i][j]=0;
}
}
rep(j,n){
rep(t,2*n*X+5){
if(j==0||t==n*X){dp[j][t]=1;}
else if(j>=1){
if(t-y[j]<0||t-y[j]>2*n*x){
dp[j][t]=dp[j-1][t];
}
else{dp[j][t]=dp[j-1][t]+dp[j-1][t-y[j]];}
}
else {dp[j][t]=0;}
}
}
cout<<dp[n][n*x]-1<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:34:56: error: no match for 'operator*' (operand types are 'int' and 'std::vector<long long int>')
34 | if(t-y[j]<0||t-y[j]>2*n*x){
| ~~~^~
| | |
| | std::vector<long long int>
| int
a.cc:42:22: error: no match for 'operator*' (operand types are 'int' and 'std::vector<long long int>')
42 | cout<<dp[n][n*x]-1<<endl;
| ~^~
| | |
| | std::vector<long long int>
| int
|
s479278860
|
p04013
|
C++
|
#include <stdio.h>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <iostream>
using namespace std;
#define Vi vector<int>
#define ll long long
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i=0;i<n;++i)
int main()
{
int N,a;
cin>>N>>a;
vector<ll>x(n);
vector<ll>y(n);
rep(i,n){
cin>>x[i];
y[i]=x[i]-a;
}
Sort(x);
ll X=x[x.size()-1];
vector<vector<ll>> dp(n+2,vector<ll>(2*n*X+5));
rep(i,n+2){
rep(j,2*n*X+5){
dp[i][j]=0;
}
}
rep(j,n){
rep(t,2*n*X+5){
if(j==0||t==n*X){dp[j][t]=1;}
else if(j>=1){
if(t-y[j]<0||t-y[j]>2*N*x)){
dp[j][t]=dp[j-1][t];
}
else{dp[j][t]=dp[j-1][t]+dp[j-1][t-y[j]];}
}
else {dp[j][t]=0;}
}
}
cout<<dp[n][n*x]-1<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:16:21: error: 'n' was not declared in this scope
16 | vector<ll>x(n);
| ^
a.cc:34:56: error: no match for 'operator*' (operand types are 'int' and 'std::vector<long long int>')
34 | if(t-y[j]<0||t-y[j]>2*N*x)){
| ~~~^~
| | |
| | std::vector<long long int>
| int
a.cc:34:59: error: expected primary-expression before ')' token
34 | if(t-y[j]<0||t-y[j]>2*N*x)){
| ^
|
s098426491
|
p04013
|
C++
|
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<stack>
#include<map>
#include<list>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
#define P pair<ll,ll>
//#define __int64 long long
int n,a;
int x[100];
ll dp[51][5100];
const int Z=2500;
const int M=100;
int main(){
cin>>n>>a;
rep(i,n)cin>>x[i];
rep(i,n)x[i]-=a;
//rep(i,M)rep(j,M)dp[i][j]=-1;
dp[0][Z]=1;
rep(i,n){
for(int j=-Z;j<=Z;j++){
dp[i+1][j+x[i]+Z]+=dp[i][j+Z];
dp[i+1][j+Z]+=dp[i][j+Z];
}
}
cout<<dp[n][Z]-1<<endl;
return 0;
}
|
a.cc:17:12: error: '__int64' does not name a type; did you mean '__int64_t'?
17 | #define ll __int64
| ^~~~~~~
a.cc:23:1: note: in expansion of macro 'll'
23 | ll dp[51][5100];
| ^~
a.cc: In function 'int main()':
a.cc:32:9: error: 'dp' was not declared in this scope; did you mean 'mp'?
32 | dp[0][Z]=1;
| ^~
| mp
|
s171311793
|
p04013
|
C++
|
#include <iostream>
using namespace std;
int main() {
int n, a;
cin >> n >> a;
int x[60];
for (int i = 0; i < n; ++i) {
cin >> x[i];
}
long long dp[60][60][2510] = {0};
dp[0][0][0] = 1;
for (int j = 0; j <= n; ++j) {
for (int k = 0; k <= n; ++k) {
for (int s = 0; s <= n*a; ++s) {
if (k >= 1 && x[j] <= s) {
d[j+1][k][s] = d[j][k][s] + d[j][k-1][s-x[j]];
} else {
d[j+1][k][s] = d[j][k][s];
}
}
}
}
long long result = 0;
for (int k = 1; k <= n; ++k) {
result += dp[n][k][k*a];
}
cout << result << endl;
}
|
a.cc: In function 'int main()':
a.cc:24:21: error: 'd' was not declared in this scope
24 | d[j+1][k][s] = d[j][k][s] + d[j][k-1][s-x[j]];
| ^
a.cc:26:21: error: 'd' was not declared in this scope
26 | d[j+1][k][s] = d[j][k][s];
| ^
|
s141490515
|
p04013
|
C++
|
#include <bits/stdc++.h>
#define P pair<int,int>
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dp[60][60][2510];
int main() {
int n, A;
cin >> n >> A;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
dp[0][0][0] = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
for (int k = 0; k <= 2500; k++) {
if (a[j] <= k && j >= 1) {
dp[i + 1][j][k] = dp[i][j][k] + dp[i][j - 1][k - a[j]];
} else {
dp[i + 1][j][k] = dp[i][j][k];
}
}
}
}
int ans = 0;
for (int i = 0; i <= n; i++) {
ans += dp[n][j][j * A];
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:29:30: error: 'j' was not declared in this scope
29 | ans += dp[n][j][j * A];
| ^
|
s915736695
|
p04013
|
C++
|
#include <bits/stdc++.h>
#define P pair<int,int>
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dp[60][60][2510];
int main() {
int n, A;
cin >> n >> A;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
dp[0][0][0] = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
for (int k = 0; k <= 2500; k++) {
if (a[j] <= k && j >= 1) {
a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
} else {
a[i + 1][j][k] = a[i][j][k];
}
}
}
}
int ans = 0;
for (int i = 0; i <= n; i++) {
ans += dp[n][j][j * A];
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:20:49: error: invalid types 'int[int]' for array subscript
20 | a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
| ^
a.cc:20:62: error: invalid types 'int[int]' for array subscript
20 | a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
| ^
a.cc:20:75: error: invalid types 'int[int]' for array subscript
20 | a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
| ^
a.cc:22:49: error: invalid types 'int[int]' for array subscript
22 | a[i + 1][j][k] = a[i][j][k];
| ^
a.cc:22:62: error: invalid types 'int[int]' for array subscript
22 | a[i + 1][j][k] = a[i][j][k];
| ^
a.cc:29:30: error: 'j' was not declared in this scope
29 | ans += dp[n][j][j * A];
| ^
|
s285691324
|
p04013
|
C++
|
#include <bits/stdc++.h>
#define P pair<int,int>
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dp[60][60][2510];
int main() {
int n, A;
cin >> n >> A;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
dp[0][0][0] = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
for (int i = 0; i <= 2500; i++) {
if (a[j] <= k && j >= 1) {
a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
} else {
a[i + 1][j][k] = a[i][j][k];
}
}
}
}
int ans = 0;
for (int i = 0; i <= n; i++) {
ans += dp[n][j][j * A];
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:19:45: error: 'k' was not declared in this scope
19 | if (a[j] <= k && j >= 1) {
| ^
a.cc:20:49: error: invalid types 'int[int]' for array subscript
20 | a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
| ^
a.cc:20:62: error: invalid types 'int[int]' for array subscript
20 | a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
| ^
a.cc:20:75: error: invalid types 'int[int]' for array subscript
20 | a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
| ^
a.cc:22:49: error: invalid types 'int[int]' for array subscript
22 | a[i + 1][j][k] = a[i][j][k];
| ^
a.cc:22:62: error: invalid types 'int[int]' for array subscript
22 | a[i + 1][j][k] = a[i][j][k];
| ^
a.cc:29:30: error: 'j' was not declared in this scope
29 | ans += dp[n][j][j * A];
| ^
|
s107460626
|
p04013
|
C++
|
#include <bits/stdc++.h>
#define P pair<int,int>
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dp[60][60][2510];
int main() {
int n, a;
cin >> n >> a;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
dp[0][0][0] = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
for (int i = 0; i <= 2500; i++) {
if (a[j] <= k && j >= 1) {
a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
} else {
a[i + 1][j][k] = a[i][j][k];
}
}
}
}
int ans = 0;
for (int i = 0; i <= n; i++) {
ans += dp[n][j][j * a];
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:13: error: conflicting declaration 'int a [n]'
11 | int a[n];
| ^
a.cc:9:16: note: previous declaration as 'int a'
9 | int n, a;
| ^
a.cc:13:25: error: invalid types 'int[int]' for array subscript
13 | cin >> a[i];
| ^
a.cc:19:38: error: invalid types 'int[int]' for array subscript
19 | if (a[j] <= k && j >= 1) {
| ^
a.cc:19:45: error: 'k' was not declared in this scope
19 | if (a[j] <= k && j >= 1) {
| ^
a.cc:20:42: error: invalid types 'int[int]' for array subscript
20 | a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
| ^
a.cc:20:59: error: invalid types 'int[int]' for array subscript
20 | a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
| ^
a.cc:20:72: error: invalid types 'int[int]' for array subscript
20 | a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
| ^
a.cc:20:88: error: invalid types 'int[int]' for array subscript
20 | a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
| ^
a.cc:22:42: error: invalid types 'int[int]' for array subscript
22 | a[i + 1][j][k] = a[i][j][k];
| ^
a.cc:22:59: error: invalid types 'int[int]' for array subscript
22 | a[i + 1][j][k] = a[i][j][k];
| ^
a.cc:29:30: error: 'j' was not declared in this scope
29 | ans += dp[n][j][j * a];
| ^
|
s660107632
|
p04013
|
C++
|
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll MOD = 1e9+7;
//LLONG_MIN
//枝刈り・方向意識バージョン(おそらく最速)
//改変前:AC
//今:未完成
int main(void){
ll N,A,p[51];
mp M;
scanf("%lld%lld",&N,&A);
rep(i,N){
scanf("%lld",&p[i]);
p[i]-=A;//合計が0になれば良い
}
sort(p,p+N);//小→大
rep(i,N){
if(p[i]>0){//方向は正:小から計算。 2
for (mp::iterator q=M.begin(); q!=M.end();++q) {
if(q->first+p[i] <= 0)break;
M[q->first+p[i]]+=q->second;//0到達時点で0より大なら計算不要
}
}else{//方向は負:どっちから計算しても良さそう 1
for (mp::iterator q=M.begin(); q!=M.end();++q) {
M[q->first+p[i]]+=q->second;
}
}
M[p[i]]+=1;
}
printf("%lld\n",M[0]);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:40:34: error: 'iterator' is not a member of 'mp' {aka 'std::pair<long long int, long long int>'}
40 | for (mp::iterator q=M.begin(); q!=M.end();++q) {
| ^~~~~~~~
a.cc:40:56: error: 'q' was not declared in this scope
40 | for (mp::iterator q=M.begin(); q!=M.end();++q) {
| ^
a.cc:40:61: error: 'mp' {aka 'struct std::pair<long long int, long long int>'} has no member named 'end'
40 | for (mp::iterator q=M.begin(); q!=M.end();++q) {
| ^~~
a.cc:45:34: error: 'iterator' is not a member of 'mp' {aka 'std::pair<long long int, long long int>'}
45 | for (mp::iterator q=M.begin(); q!=M.end();++q) {
| ^~~~~~~~
a.cc:45:56: error: 'q' was not declared in this scope
45 | for (mp::iterator q=M.begin(); q!=M.end();++q) {
| ^
a.cc:45:61: error: 'mp' {aka 'struct std::pair<long long int, long long int>'} has no member named 'end'
45 | for (mp::iterator q=M.begin(); q!=M.end();++q) {
| ^~~
a.cc:49:14: error: no match for 'operator[]' (operand types are 'mp' {aka 'std::pair<long long int, long long int>'} and 'll' {aka 'long long int'})
49 | M[p[i]]+=1;
| ^
a.cc:51:26: error: no match for 'operator[]' (operand types are 'mp' {aka 'std::pair<long long int, long long int>'} and 'int')
51 | printf("%lld\n",M[0]);
| ^
|
s523348397
|
p04013
|
C++
|
#include <iostream>
#include <vector>
#include <stdlib.h>
using namespace std;
int main()
{
int N, A;
cin >> N >> A;
cout << N << A << endl;
int *ary = new int[N + 1];
for (int i = 1; i <= N; ++i)
{
cin >> ary[i];
}
long memo[51][51][50 * 50 + 1];
memset(memo, 0, sizeof(memo));
memo[0][0][0] = 1;
cout << 1243 << endl;
for (int j = 1; j < N + 1; ++j)
{
for (int k = 0; k < N + 1; ++k)
{
for (int s = 0; s < N * A + 1; ++s)
{
if (j >= 1 && s < ary[j])
memo[j][k][s] = memo[j - 1][k][s];
else if (j >= 1 && s >= ary[j] && k >= 1)
memo[j][k][s] = memo[j - 1][k][s] + memo[j - 1][k - 1][s - ary[j]];
}
}
}
long sum = 0;
for (int i = 1; i < N + 1; ++i)
{
sum += memo[N][i][i * A];
}
cout << 123 << endl;
cout << sum << endl;
delete[] ary;
cout << 12 << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:19:5: error: 'memset' was not declared in this scope
19 | memset(memo, 0, sizeof(memo));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <stdlib.h>
+++ |+#include <cstring>
4 |
|
s088737705
|
p04013
|
C++
|
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
int main()
{
int N, A;
cin >> N >> A;
cout << N << A << endl;
int *ary = new int[N + 1];
for (int i = 1; i <= N; ++i)
{
cin >> ary[i];
}
long memo[51][51][50 * 50 + 1];
memset(memo, 0, sizeof(memo));
memo[0][0][0] = 1;
cout << 1243 << endl;
for (int j = 1; j < N + 1; ++j)
{
for (int k = 0; k < N + 1; ++k)
{
for (int s = 0; s < N * A + 1; ++s)
{
if (j >= 1 && s < ary[j])
memo[j][k][s] = memo[j - 1][k][s];
else if (j >= 1 && s >= ary[j] && k >= 1)
memo[j][k][s] = memo[j - 1][k][s] + memo[j - 1][k - 1][s - ary[j]];
}
}
}
long sum = 0;
for (int i = 1; i < N + 1; ++i)
{
sum += memo[N][i][i * A];
}
cout << 123 << endl;
cout << sum << endl;
delete[] ary;
cout << 12 << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:19:5: error: 'memset' was not declared in this scope
19 | memset(memo, 0, sizeof(memo));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <cstdlib>
+++ |+#include <cstring>
4 |
|
s659614000
|
p04013
|
C++
|
#include <iostream>
#include <vector>
using namespace std;
int dp(int j, int k, int s, int[] X)
{
if (j == 0 && k == 0 && s == 0)
{
return 1;
}
else if (j >= 1 && s < X[j])
{
return dp(j - 1, k, s);
}
else if (j >= 1 && s >= X[j])
{
return dp(j - 1, k, s) + dp(j - 1, k - 1, s - X[j]);
}
else
{
return 0;
}
}
int main()
{
int N, A;
cin >> N >> A;
int *ary = new int[N];
for (int i = 0; i < N; ++i)
{
cin >> ary[i];
}
vector<vector<vector<int>>> memo(N);
for (int i = 0; i < N; ++i)
{
memo[i].resize(N + 1);
for (int j = 0; j < N + 1; ++j)
{
memo[i][j].resize(N * A + 1);
for (int s = 0; s < N * A + 1; ++s)
{
memo[i][j][s] = 0;
}
}
}
int sum = 0;
for (int i = 0; i < N + 1; ++i)
{
sum += dp(N, i, N * A, ary);
}
cout << sum << endl;
delete[] ary;
return 0;
}
|
a.cc:6:35: error: expected ',' or '...' before 'X'
6 | int dp(int j, int k, int s, int[] X)
| ^
a.cc: In function 'int dp(int, int, int, int*)':
a.cc:12:28: error: 'X' was not declared in this scope
12 | else if (j >= 1 && s < X[j])
| ^
a.cc:14:18: error: too few arguments to function 'int dp(int, int, int, int*)'
14 | return dp(j - 1, k, s);
| ~~^~~~~~~~~~~~~
a.cc:6:5: note: declared here
6 | int dp(int j, int k, int s, int[] X)
| ^~
a.cc:18:18: error: too few arguments to function 'int dp(int, int, int, int*)'
18 | return dp(j - 1, k, s) + dp(j - 1, k - 1, s - X[j]);
| ~~^~~~~~~~~~~~~
a.cc:6:5: note: declared here
6 | int dp(int j, int k, int s, int[] X)
| ^~
|
s255210636
|
p04013
|
C++
|
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x) cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int
int dp[51][51][2501];
signed main(void)
{
cin.tie(0);
ios::sync_with_stdio(false);
int N, A;
cin >> N >> A;
int x[N];
rep(i, N) cin >> x[i];
//rep(i, N) cout << x[i] << " ";
//cout << endl;
dp[0][0][0] = 1;
rep(k, N) {
rep(i, N) {
rep(j, 2501) {
dp[k][i+1][j] += dp[k][i][j];
if (j - x[i] >= 0) dp[k+1][i+1][j] += dp[k][i][j-x[i]];
}
}
}
ll ans = 0;
REP(i, 1, N) ans += dp[i][N][A*i];
REP(i, 1, N) {
//cout << "dp[" << N << "][" << A*i << "] =" << dp[i][N][A*i] << endl;
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:12:13: error: 'long long long' is too long for GCC
12 | #define int long long int
| ^~~~
a.cc:3:22: note: in expansion of macro 'int'
3 | #define ll long long int
| ^~~
a.cc:37:5: note: in expansion of macro 'll'
37 | ll ans = 0;
| ^~
a.cc:12:18: error: 'long long long' is too long for GCC
12 | #define int long long int
| ^~~~
a.cc:3:22: note: in expansion of macro 'int'
3 | #define ll long long int
| ^~~
a.cc:37:5: note: in expansion of macro 'll'
37 | ll ans = 0;
| ^~
|
s652864179
|
p04013
|
C++
|
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x) cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int
int dp[51][51][2501];
int main(void)
{
cin.tie(0);
ios::sync_with_stdio(false);
int N, A;
cin >> N >> A;
int x[N];
rep(i, N) cin >> x[i];
//rep(i, N) cout << x[i] << " ";
//cout << endl;
dp[0][0][0] = 1;
rep(k, N) {
rep(i, N) {
rep(j, 2501) {
dp[k][i+1][j] += dp[k][i][j];
if (j - x[i] >= 0) dp[k+1][i+1][j] += dp[k][i][j-x[i]];
}
}
}
ll ans = 0;
REP(i, 1, N) ans += dp[i][N][A*i];
REP(i, 1, N) {
//cout << "dp[" << N << "][" << A*i << "] =" << dp[i][N][A*i] << endl;
}
cout << ans << endl;
return 0;
}
|
a.cc:12:23: error: '::main' must return 'int'
12 | #define int long long int
| ^~~
a.cc:15:1: note: in expansion of macro 'int'
15 | int main(void)
| ^~~
a.cc: In function 'int main()':
a.cc:12:13: error: 'long long long' is too long for GCC
12 | #define int long long int
| ^~~~
a.cc:3:22: note: in expansion of macro 'int'
3 | #define ll long long int
| ^~~
a.cc:37:5: note: in expansion of macro 'll'
37 | ll ans = 0;
| ^~
a.cc:12:18: error: 'long long long' is too long for GCC
12 | #define int long long int
| ^~~~
a.cc:3:22: note: in expansion of macro 'int'
3 | #define ll long long int
| ^~~
a.cc:37:5: note: in expansion of macro 'll'
37 | ll ans = 0;
| ^~
|
s082215673
|
p04013
|
C++
|
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
typedef pair<LL, LL> P;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x) (x).begin(),(x).end()
# define UNIQ(c) (c).erase(unique(ALL((c))),(c).end())
# define mp make_pair
# define eb emplace_back
# define FOR(i,a,b) for(int i=(a);i<(b);i++)
# define RFOR(i,a,b) for(int i=(a);i>=(b);i--)
# define REP(i,n) FOR(i,0,n)
# define INIT std::ios::sync_with_stdio(false);std::cin.tie(0)
#define int LL
int n, a, x[101];
int dp[55][55][2550];
int main() {
cin >> n >> a;
REP(i, n)cin >> x[i];
dp[0][0][0] = 1;
int ans = 0;
REP(i, n)REP(j, n)REP(k, 2500) {
dp[i + 1][j][k] += dp[i][j][k];
dp[i + 1][j + 1][k + x[i]] = dp[i][j][k];
}
for (int j = 1; j <= n; j++) {
ans += dp[n][j][a*j];
}
cout << ans << endl;
}
|
a.cc:41:13: error: '::main' must return 'int'
41 | #define int LL
| ^~
a.cc:46:1: note: in expansion of macro 'int'
46 | int main() {
| ^~~
|
s824257769
|
p04013
|
C++
|
#include <stdio.h>
#include <vector>
int main(){
int N, A, tmp;
int x[51];
scanf("%d %d", &N, &A);
for(int i = 0; i < N; ++i){
scanf("%d", &tmp);
x[i + 1] = tmp;
}
int X = std::max(*std::max_element(&x[1], &x[N]), A);
long long int dp[N + 1][2 * N * X + 1];
for(int i = 0; i < N; ++i){
x[i + 1] -= A;
}
for(int j = 0; j <= N; ++j){
for(int t = 0; t <= 2 * N * X; ++t){
if (j == 0 && t == N * X) {
dp[j][t] = 1;
} else if (1 <= j && 0 <= t - x[j] && t - x[j] <= 2 * N * X){
dp[j][t] = dp[j - 1][t - x[j]] + dp[j - 1][t];
} else if (1 <= j && (t - x[j] < 0 || 2 * N * X < t - x[j])){
dp[j][t] = dp[j - 1][t];
} else {
dp[j][t] = 0;
}
}
}
printf("%lld\n", dp[N][N * X] - 1);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:14:28: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'?
14 | int X = std::max(*std::max_element(&x[1], &x[N]), A);
| ^~~~~~~~~~~
| tuple_element
|
s238196573
|
p04013
|
C++
|
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#define rep(i, m, n) for (int i = m; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout << #x << ": " << x << endl
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
ll n,a;
ll x[51]={};
ll dp[51][51][2503];
ll dfs(int i, int cnt, int sum){
if(dp[i][cnt][sum]!=-1)return dp[i][cnt][sum];
if (i == n){
return cnt != 0 && sum == cnt * a;
}
ll res = 0;
res += dfs(i+1, cnt, sum) + dfs(i + 1, cnt + 1, sum + x[i]);
return dp[i][cnt][sum] = res;
}
int main(){
memset(dp, -1, sizeof(dp));
cin>>n>>a;
for(int i=0; i<n; i++)cin>>x[i];
cout<<dfs(0,0,0)<<endl;
}
|
a.cc: In function 'int main()':
a.cc:43:5: error: 'memset' was not declared in this scope
43 | memset(dp, -1, sizeof(dp));
| ^~~~~~
a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
7 | #include <cctype>
+++ |+#include <cstring>
8 | #define rep(i, m, n) for (int i = m; i < n; i++)
|
s631342272
|
p04013
|
C++
|
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#define rep(i, m, n) for (int i = m; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout << #x << ": " << x << endl
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
ll x[55]={};
ll dp[10005][10005][10005]={};
ll dfs(int i,int cnt, int sum){
if(dp[i][cnt][sum]!=0)return dp[i][cnt][sum];
ll res;
if (i==n){
if (cnt != 0){
return (double)sum / cnt == (double)a;
}else{
return 0;
}
}else{
res = dfs(i+1, cnt, sum) + dfs(i+1, cnt+1, sum + x[i]);
}
return dp[i][cnt][sum] = res;
}
int main(){
int ans=0;
cin>>n>>a;
for(int i=0; i<n; i++)cin>>x[i];
cout<<dfs(0,0,0)<<endl;
}
|
a.cc: In function 'long long int dfs(int, int, int)':
a.cc:33:13: error: 'n' was not declared in this scope
33 | if (i==n){
| ^
a.cc:35:50: error: 'a' was not declared in this scope
35 | return (double)sum / cnt == (double)a;
| ^
a.cc: In function 'int main()':
a.cc:47:10: error: 'n' was not declared in this scope
47 | cin>>n>>a;
| ^
a.cc:47:13: error: 'a' was not declared in this scope
47 | cin>>n>>a;
| ^
|
s342561670
|
p04013
|
C++
|
a
|
a.cc:1:1: error: 'a' does not name a type
1 | a
| ^
|
s857743091
|
p04013
|
C++
|
#include<fstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;
int m1=0,m2=0;
int N,A,x[50],y[50],dp[1<<26];
vector<int> r[2][50];
long long res=0;
int nb(int bits)
{
bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}
int bdp(int n,int a[25],int p)
{
if(dp[p]>=0)return dp[p];
if(p==0)return dp[p]=0;
for(int i=0;i<n;i++)
{
if(((p>>i)&1))
{
int x=p^(1<<i);
int r=bdp(n,a,x)+a[i];
dp[p]=r;
}
}
return dp[p];
}
int main()
{
scanf("%d%d",&N,&A);
for(int i=0;i<N;i++)
{
if(i<N/2)scanf("%d",&x[i]);
else scanf("%d",&y[i-N/2]);
}
memset(dp,-1,sizeof(dp));
bdp(N/2,x,(1<<(N/2))-1);
for(int i=0;i<1<<N/2;i++)
{
r[0][nb(i)].push_back(dp[i]);
m1=max(m1,nb(i));
}
memset(dp,-1,sizeof(dp));
bdp(N-N/2,y,(1<<(N-N/2))-1);
for(int i=0;i<1<<N/2;i++)
{
r[1][nb(i)].push_back(dp[i]);
m2=max(m2,nb(i));
}
for(int i=0;i<=m1;i++)
{
sort(r[0][i].begin(),r[0][i].end(),less<int>());
for(int j=0;j<=m2;j++)
{
if(i==0&&j==0)continue;
sort(r[1][j].begin(),r[1][j].end(),less<int>());
for(int k=0;k<r[0][i].size();k++)
{
int a=A*(i+j)-r[0][i][k];
long long x=upper_bound(r[1][j].begin(),r[1][j].end(),a)-lower_bound(r[1][j].begin(),r[1][j].end(),a);
res+=x;
}
}
}
printf("%lld\n",res);
}
|
a.cc: In function 'int main()':
a.cc:50:9: error: 'memset' was not declared in this scope
50 | memset(dp,-1,sizeof(dp));
| ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
9 | #include<set>
+++ |+#include <cstring>
10 | using namespace std;
|
s513904669
|
p04013
|
C++
|
#include <bits/stdc++.h>
const long long INF = LLONG_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++)
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
using namespace std;
vector<ll> v;
vector<pair<ll, ll>> vp;
vector<vector<ll>> vv(110, vector<ll>(50, 0));
vector<tuple<ll, ll, ll>> vt;
set<ll> st;
map<ll, ll> mp;
int main()
{
ll n, k;
cin >> n >> k;
v.resize(n);
REP(i, n) cin >> v[i];
REP(i, n) v[i] -= k;
sort(ALL(v));
REP(i, v.size() - 1) {
if(!v[i])
{
mp[v[i]]++;
v.erase(v.begin() + i);
i--;
}
}
REP(i, v.size()) mp[v[i]]++;
ll cnt = pow(2, v.size());
ll ans = 0;
while (cnt--,cnt>0)
{
ll a = 0;
ll b = cnt;
ll c = 0;
vector<ll> vm;
map<ll, ll> pm;
while(b)
{
if (b & 1) {
c += v[a];
vm.push_back(v[a]);
pm[v[a]]++;
}
b >>= 1;
a++;
}
if(!c)
{
ll prod = 1;
vector<ll> div;
REP(i, vm.size()) {
prod *= mp[vm[i]] - pm[vm[i]] + 1;
if(mp[vm[i]]-pm[vm[i]])
{
div.push_back()
}
}
prod *= pow(2, mp[0]);
REP(i, vm.size())
{
cout << vm[i] << " " << prod << endl;
}
cout << endl;
ans += prod;
}
}
ans += pow(2, mp[0]) - 1;
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:61:54: error: no matching function for call to 'std::vector<long long int>::push_back()'
61 | div.push_back()
| ~~~~~~~~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate expects 1 argument, 0 provided
|
s000787677
|
p04013
|
C++
|
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[100][100][3100];
int main()
{
ll sum=0(ll);
ll x,y,z;
ll a[1000];
cin>>x>>z;
for(int i=0;i<x;i++)
{
cin>>a[i];
}
dp[0][0][0]=1(ll);
for(int i=0;i<x;i++)
{
for(int j=0;j<=i;j++)
{
for(int k=0;k<2051;k++)
{
dp[i+1][j+1][k+a[i]]+=dp[i][j][k];
dp[i + 1][j][k] += dp[i][j][k];
}
}
}
for(int i=1;i<=x;i++)
{
sum+=dp[x][i][i*z];
}
cout<<sum<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:3:12: error: expected primary-expression before 'long'
3 | #define ll long long
| ^~~~
a.cc:7:14: note: in expansion of macro 'll'
7 | ll sum=0(ll);
| ^~
a.cc:7:16: error: expression cannot be used as a function
7 | ll sum=0(ll);
| ^
a.cc:3:12: error: expected primary-expression before 'long'
3 | #define ll long long
| ^~~~
a.cc:15:19: note: in expansion of macro 'll'
15 | dp[0][0][0]=1(ll);
| ^~
a.cc:15:21: error: expression cannot be used as a function
15 | dp[0][0][0]=1(ll);
| ^
|
s463173121
|
p04013
|
C++
|
long A,x[50],i,j,d[51][5001];main(n){for(scanf("%d%d",&n,&A);~scanf("%d",x+i);x[i++]-=A);d[0][A*=n]=1;for(i=-1;++i<n;)for(j=-1+x[i];j++<2*A+x[i];d[i+1][j]+=d[i][j])d[i+1][j]=d[i][j-x[i]];printf("%ld\n",d[n][A]-1);}
|
a.cc:1:34: error: expected constructor, destructor, or type conversion before '(' token
1 | long A,x[50],i,j,d[51][5001];main(n){for(scanf("%d%d",&n,&A);~scanf("%d",x+i);x[i++]-=A);d[0][A*=n]=1;for(i=-1;++i<n;)for(j=-1+x[i];j++<2*A+x[i];d[i+1][j]+=d[i][j])d[i+1][j]=d[i][j-x[i]];printf("%ld\n",d[n][A]-1);}
| ^
|
s704496271
|
p04013
|
C++
|
/**
* @Author Mehdi Maick
* Created on 05/12/2016.
*/
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
static int n;
static int A;
static int[] tab;
static HashMap<String, Long> memo = new HashMap<>();
static long f(int i, long sum, int inset) {
if (i >= 0 && A * inset == sum) {
System.err.println(inset + " " + sum);
return 1L;
}
if (i < 0) return 0;
String key = i + " " + sum + " " + inset;
if (memo.containsKey(key)) return memo.get(key);
long ans = f(i - 1, sum, inset);
if (i >= 0)
ans += f(i - 1, sum - tab[i], inset - 1);
memo.put(key, ans);
return ans;
}
public static void solve(FastReader fs, PrintWriter pw) {
n = fs.nextInt();
A = fs.nextInt();
tab = new int[n];
int mx = 2550;
for (int i = 0; i < n; i++)
tab[i] = fs.nextInt();
long[][] f = new long[n + 1][3000];
f[0][0] = 1;
for (int i = 1; i <= n; i++) {
for (int j = i - 1; j >= 0; j--) {
for (int k = 0; k < mx; k++) {
f[j + 1][k + tab[i - 1]] += f[j][k];
}
}
}
long ans = 0;
for (int i = 1; i <= n; i++) {
ans += f[i][i * A];
}
pw.println(ans);
}
public static void main(String[] args) throws Exception {
FastReader fs = new FastReader(System.in);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
solve(fs, pw);
fs.close();
pw.close();
}
static class FastReader {
BufferedReader reader;
StringTokenizer st;
FastReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream));
st = null;
}
String next() {
while (st == null || !st.hasMoreTokens()) {
try {
String line = reader.readLine();
if (line == null) {
return null;
}
st = new StringTokenizer(line);
} catch (Exception e) {
throw new RuntimeException();
}
}
return st.nextToken();
}
String nextLine() {
String s = null;
try {
s = reader.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return s;
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
char nextChar() {
return next().charAt(0);
}
int[] nextIntArray(int n) {
int[] arr = new int[n];
int i = 0;
while (i < n) {
arr[i++] = nextInt();
}
return arr;
}
long[] nextLongArray(int n) {
long[] arr = new long[n];
int i = 0;
while (i < n) {
arr[i++] = nextLong();
}
return arr;
}
int[] nextIntArrayOneBased(int n) {
int[] arr = new int[n + 1];
int i = 1;
while (i <= n) {
arr[i++] = nextInt();
}
return arr;
}
long[] nextLongArrayOneBased(int n) {
long[] arr = new long[n + 1];
int i = 1;
while (i <= n) {
arr[i++] = nextLong();
}
return arr;
}
void close() {
try {
reader.close();
} catch (IOException e) {
System.err.println("There's been an error trying closing the reader ");
e.printStackTrace();
}
}
}
}
|
a.cc:6:1: error: 'import' does not name a type
6 | import java.util.*;
| ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
7 | import java.io.*;
| ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: 'import' does not name a type
8 | import static java.lang.Math.*;
| ^~~~~~
a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:10:1: error: expected unqualified-id before 'public'
10 | public class Main {
| ^~~~~~
|
s458590400
|
p04013
|
C++
|
#include<stdio.h>
long long int n, c, d[50],f[51][51];
long long int as(long long int a, long long int b){
if(f[a][b]>0) return f[a][b];
if(a==n){
if(b==0){
return 1;
}
else return 0;
}
return f[a][b][e]=as(a+1,(b+d[a])%c)+as(a+1,b);
}
int main(){
scanf("%lld %lld",&n,&c);
for(int i=0;i<n;i++) scanf("%lld",d+i);
printf("%lld",as(0,0,0)-1);
}
|
a.cc: In function 'long long int as(long long int, long long int)':
a.cc:11:24: error: 'e' was not declared in this scope
11 | return f[a][b][e]=as(a+1,(b+d[a])%c)+as(a+1,b);
| ^
a.cc: In function 'int main()':
a.cc:16:25: error: too many arguments to function 'long long int as(long long int, long long int)'
16 | printf("%lld",as(0,0,0)-1);
| ~~^~~~~~~
a.cc:3:15: note: declared here
3 | long long int as(long long int a, long long int b){
| ^~
|
s984855624
|
p04013
|
C++
|
#include<iostream>
#include<vector>
using namespace std;
int memo[60][1000];
vector<int> X;
long long solve(int i, long long j) {
if (memo[i][j] != -1) return memo[i][j];
if (i == X.size()) return (j == 0);
return memo[i][j] = (solve(i+1, j)+solve(i + 1, j + X[i]));
}
int main() {
int n, a;
cin >> n >> a;
X.resize(n);
for (int i = 0; i < n; i++)cin >> X[i];
for (auto &v : X)v -= a;
memset(*memo, -1, sizeof(memo));
cout << solve(0,0)-1 << endl;
}
|
a.cc: In function 'int main()':
a.cc:22:9: error: 'memset' was not declared in this scope
22 | memset(*memo, -1, sizeof(memo));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<vector>
+++ |+#include <cstring>
3 |
|
s402544633
|
p04013
|
C++
|
#include <iostream>
#include <array>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <string>
#include <limits>
#include <cassert>
#include <fstream>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <ciso646>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define inf INT_MAX/3
#define INF INT_MAX/3
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 2*acos(0.0)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE()freopen("out0.txt","w",stdout)
#define in scanf
#define out printf
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define FST first
#define SEC second
#define int ll
signed main(void) {
int N, A; cin >> N >> A;
vector<int> X(N); for(auto &a:X) cin >> a;
int maxX = *max_element(ALL(X));
if(maxX < A){
cout << -1 << endl;
return 0;
}
vector<int> x(N);
REP(i,N){
#include <iostream>
#include <array>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <string>
#include <limits>
#include <cassert>
#include <fstream>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <ciso646>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define inf INT_MAX/3
#define INF INT_MAX/3
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 2*acos(0.0)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE()freopen("out0.txt","w",stdout)
#define in scanf
#define out printf
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define FST first
#define SEC second
#define int ll
signed main(void) {
int N, A; cin >> N >> A;
vector<int> X(N); for(auto &a:X) cin >> a;
int maxX = *max_element(ALL(X));
if(maxX < A){
cout << 0 << endl;
return 0;
}
vector<int> x(N);
REP(i,N){
x[i] = X[i] - A;
}
int dp[51][5002] = {};
memset(dp, 0, sizeof(dp));
dp[0][N*maxX] = 1;
FOR(i,0,N){
RFOR(j,0,2*N*maxX+1){
if(0 <= j-x[i] and j-x[i] <= 2*N*maxX){
dp[i+1][j] = dp[i][j-x[i]] + dp[i][j];
}
else{
dp[i+1][j] = dp[i][j];
}
}
}
cout << dp[N][N*maxX] - 1 << endl;
return 0;
}
x[i] = X[i] - A;
}
int dp[51][5002] = {};
memset(dp, 0, sizeof(dp));
dp[0][N*maxX] = 1;
FOR(i,0,N){
RFOR(j,0,2*N*maxX+1){
if(0 <= j-x[i] and j-x[i] <= 2*N*maxX){
dp[i+1][j] = dp[i][j-x[i]] + dp[i][j];
}
else{
dp[i+1][j] = dp[i][j];
}
}
}
cout << dp[N][N*maxX] - 1 << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:117:19: error: a function-definition is not allowed here before '{' token
117 | signed main(void) {
| ^
|
s642089784
|
p04013
|
C++
|
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
//conversion
//------------------------------------------
inline 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();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
signed main(void){
int n,a;
cin >> n >> a;
VI x(n);
REP(i,x.size()){
cin >> x[i];
//debug(x[i]);
}
int dp[52][2501];
REP(i,n+1){
REP(j,n*a+1){
dp[i][j]=0;
}
}
REP(i,n+1){
dp[i][0]=1;
}
FOR(i,1,n+1){
FOR(j,1,n*a+1){
if(j-x[i-1]>=0)dp[i][j] = dp[i-1][j] + dp[i-1][j-x[i-1]];
else dp[i][j] = dp[i-1][j];
//dump(dp[i][j]);dump(i);dump(j);
}
}
int ans =0;
for(int j=a; j < n*a+1; j+=a){
ans+=dp[n][j];
}
//dump(ans);
cout >> ans >> endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:101:8: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
101 | cout >> ans >> endl;
| ~~~~ ^~ ~~~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:101:8: note: candidate: 'operator>>(int, int)' (built-in)
101 | cout >> ans >> endl;
| ~~~~~^~~~~~
a.cc:101:8: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/vector:87,
from a.cc:3:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:101:3: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
101 | cout >> ans >> endl;
| ^~~~
In file included from /usr/include/c++/14/string:55,
from /usr/include/c++/14/bitset:52,
from a.cc:9:
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:101:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
101 | cout >> ans >> endl;
| ^~~
/usr/include/c++/14/bitset:1597:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, bitset<_Nb>&)'
1597 | operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)
| ^~~~~~~~
/usr/include/c++/14/bitset:1597:5: note: template argument deduction/substitution failed:
a.cc:101:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
101 | cout >> ans >> endl;
| ^~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/sstream:40,
from a.cc:14:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:101:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
101 | cout >> ans >> endl;
| ^~~
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:101:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
101 | cout >> ans >> endl;
| ^~~
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:101:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
101 | cout >> ans >> endl;
| ^~~
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:101:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
101 | cout >> ans >> endl;
| ^~~
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:101:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
101 | cout >> ans >> endl;
| ^~~
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:101:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
101 | cout >> ans >> endl;
| ^~~
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]':
a.cc:101:11: required from here
101 | cout >> ans >> endl;
| ^~~
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
In file included from a.cc:16:
/usr/include/c++/14/iomanip:76:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Resetiosflags)'
76 | operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:76:5: note: template argument deduction/substitution failed:
a.cc:101:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
101 | cout >> ans >> endl;
| ^~~
/usr/include/c++/14/iomanip:106:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setiosflags)'
106 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:106:5: note: template argument deduction/substitution failed:
a.cc:101:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
101 | cout >> ans >> endl;
| ^~~
/usr/include/c++/14/iomanip:137:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setbase)'
137 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:137:5: note: template argument deduction/substitution failed:
a.cc:101:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
101 | cout >> ans >> endl;
| ^~~
/usr/include/c++/14/iomanip:177:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setfill<_CharT>)'
177 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:177:5: note: template argument deduction/substitution failed:
a.cc:101:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
101 | cout >> ans >> endl;
| ^~~
/usr/include/c++/14/iomanip:207:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setprecision)'
207 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setprecision __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:207:5: note: template argument deduction/substitution failed:
a.cc:101:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
101 | cout >> ans >> endl;
| ^~~
/usr/include/c++/14/iomanip:237:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setw)'
237 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setw __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:237:5: note: template argument deduction/substitution failed:
a.cc:101:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
101 | cout >> ans >> endl;
| ^~~
/usr/include/c++/14/iomanip:271:5: note: candidate: 'template<class _CharT, class _Traits,
|
s229767462
|
p04013
|
C++
|
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <math.h>
#include <algorithm>
using namespace std;
long long result;
void comput(long long target, vector<int>& all, int level) {
if (target == 0) {
result++;
return;
}
for (int a = level; a < all.size(); a++) {
if(all[a] > target) {
return;
}
comput(target - all[a], all, a + 1);
}
}
int main() {
int N, A;
cin >> N >> A;
vector<int> all;
for (int a = 0; a < N; a++) {
int temp;
cin >> temp;
all.push_back(temp);
}
sort(all.begin(), all.end());
for (int a = 1; a <= N; a++) {
comput((long long)A*a, all, 0);
}
cout << result << endl;
return 0;
}
|
a.cc:34:1: error: extended character is not valid in an identifier
34 | sort(all.begin(), all.end());
| ^
a.cc: In function 'int main()':
a.cc:34:1: error: '\U000000a0' was not declared in this scope
34 | sort(all.begin(), all.end());
| ^
|
s513693314
|
p04013
|
C++
|
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <math.h>
#include <algorithm>
using namespace std;
long long result;
void comput(long long target, vector<int>& all, int level) {
if (target == 0) {
result++;
return 0;
}
if (target < 0) {
return;
}
for (int a = level; a < all.size(); a++) {
comput(target - all[a], all, a + 1);
}
}
int main() {
int N, A;
cin >> N >> A;
vector<int> all;
for (int a = 0; a < N; a++) {
int temp;
cin >> temp;
all.push_back(temp);
}
for (int a = 1; a <= N; a++) {
comput((long long)A*a, all, 0);
}
cout << result << endl;
return 0;
}
|
a.cc: In function 'void comput(long long int, std::vector<int>&, int)':
a.cc:15:24: error: return-statement with a value, in function returning 'void' [-fpermissive]
15 | return 0;
| ^
|
s789150872
|
p04013
|
C++
|
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <math.h>
#include <algorithm>
using namespace std;
long long result;
void comput(long long target, vector<int>& all, int level) {
if (target == 0) {
result++;
}
if (target < 0) {
return;
}
for (int a = level; a < all.size(); a++) {
comput(target - all[a], all, a + 1);
}
}
int main() {
int N, A;
cin >> N >> A;
vector<int> all;
for (int a = 0; a < N; a++) {
int temp;
cin >> temp;
all.push_back(temp);
}
for (int a = 1; a <= N; a++) {
comput((long long)A*a, all, 0);
}
cout << result << endl;
return 0;
}
|
a.cc:7:1: error: extended character is not valid in an identifier
7 |
| ^
a.cc:9:1: error: extended character is not valid in an identifier
9 |
| ^
a.cc:11:1: error: extended character is not valid in an identifier
11 |
| ^
a.cc:23:1: error: extended character is not valid in an identifier
23 |
| ^
a.cc:33:1: error: extended character is not valid in an identifier
33 |
| ^
a.cc:7:1: error: '\U000000a0' does not name a type
7 |
| ^
a.cc:9:1: error: '\U000000a0' does not name a type
9 |
| ^
a.cc:11:1: error: '\U000000a0' does not name a type
11 |
| ^
a.cc:23:1: error: '\U000000a0' does not name a type
23 |
| ^
|
s807760070
|
p04013
|
C++
|
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long long result;
int main() {
int N, A;
cin >> N >> A;
vector<int> all;
for(int a = 0; a < N; a++) {
int temp;
cin >> temp;
all.push_back(temp);
}
sort(all);
for(int a = 1; a <= N; a++) {
comput((long long)A*a, all, 0);
}
cout << result << endl;
return 0;
}
void comput(long long target, vector<long long>& all, int level) {
if(target == 0) {
result++;
}
if(target < 0) {
return;
}
for(int a = level; a < all.size(); a++) {
compu(target - all[a], all, a + 1);
}
}
|
a.cc:4:1: error: extended character is not valid in an identifier
4 |
| ^
a.cc:6:1: error: extended character is not valid in an identifier
6 |
| ^
a.cc:8:1: error: extended character is not valid in an identifier
8 |
| ^
a.cc:18:1: error: extended character is not valid in an identifier
18 |
| ^
a.cc:20:1: error: extended character is not valid in an identifier
20 |
| ^
a.cc:27:1: error: extended character is not valid in an identifier
27 |
| ^
a.cc:4:1: error: '\U000000a0' does not name a type
4 |
| ^
a.cc:6:1: error: '\U000000a0' does not name a type
6 |
| ^
a.cc:8:1: error: '\U000000a0' does not name a type
8 |
| ^
a.cc:27:1: error: '\U000000a0' does not name a type
27 |
| ^
|
s605653214
|
p04013
|
C++
|
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long long result;
int main() {
int N, A;
cin >> N >> A;
vector<long> all;
for(int a = 0; a < N; a++) {
long long temp;
cin >> temp;
all.push_back(temp);
}
sort(all);
for(int a = 1; a <= N; a++) {
comput(A*a, all, 0);
}
cout << result << endl;
return 0;
}
void comput(long long target, vector<long long>& all, int level) {
if(target == 0) {
result++;
}
if(target < 0) {
return;
}
for(int a = level; a < all.size(); a++) {
compu(target - all[a], all, a + 1);
}
}
|
a.cc: In function 'int main()':
a.cc:19:7: error: no matching function for call to 'sort(std::vector<long int>&)'
19 | sort(all);
| ~~~~^~~~~
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 1 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate expects 3 arguments, 1 provided
a.cc:22:5: error: 'comput' was not declared in this scope
22 | comput(A*a, all, 0);
| ^~~~~~
a.cc: In function 'void comput(long long int, std::vector<long long int>&, int)':
a.cc:36:5: error: 'compu' was not declared in this scope; did you mean 'comput'?
36 | compu(target - all[a], all, a + 1);
| ^~~~~
| comput
|
s574714636
|
p04013
|
Java
|
import scala.collection.immutable.Range;
import java.math.BigInteger;
import java.util.Scanner;
/**
* Created by sonetsuyoshi on 2016/07/31.
*/
public class Main {
static public void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int A = scanner.nextInt();
int[] xs = new int[N];
BigInteger[] counts = new BigInteger[A];
for(int i = 0; i < A; i++) {
counts[i] = BigInteger.ZERO;
}
for(int i = 0; i < N;i++) {
xs[i] = scanner.nextInt();
}
for(int x: xs) {
BigInteger[] newCounts = new BigInteger[A];
for(int i = 0; i < A; i++) {
newCounts[i] = BigInteger.ZERO.add(counts[i]);
}
int y = x % A;
for (int i = 0; i < A; i++) {
counts[(i + y) % A] = counts[(i + y) % A].add(newCounts[i]);
}
counts[y] = counts[y].add(BigInteger.ONE);
}
System.out.println(counts[0].toString());
}
}
|
Main.java:2: error: package scala.collection.immutable does not exist
import scala.collection.immutable.Range;
^
1 error
|
s904102532
|
p04014
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);
struct fastio {
fastio() {
ios::sync_with_stdio(false);
cout << setprecision(10) << fixed;
cin.tie(0);
}
};
fastio _fast_io;
ll n, s;
bool check(ll x, ll y) {
ll ret = 0;
while (x) {
ret += x % y;
x /= y;
}
return ret == s;
}
int main() {
cin >> n >> s;
ll d = n - s;
if (d < 0) {
cout << -1 << endl;
return 0;
}
if (d == 0) {
cout << n + 1 << endl;
return 0;
}
ll m = sqrt(n) + 1;
for (ll i = 2; i < m; ++i) {
if (check(n, i)) {
cout << i << endl;
return 0;
}
}
// b > sqrt(n);
// (b−1)*B=n−s
ll t = n / m + 1;
for (ll B = t; B >= 1; --B) {
if (d % B == 0) {
ll b = d / B + 1;
if (b > B && n / b == B) {
cout << b << end;
return 0;
}
}
}
cout << -1 << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:53:27: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>')
53 | cout << b << end;
| ~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std
|
s775463546
|
p04014
|
C++
|
class Solution{
public:
long long minbase(long long n, long long s){
if(s == 1ll) return n;
long long b;
for(b = 2ll; b * b <= n; b ++)
if(sum(n, b) == s) return b;
assert(b * b > n);
if(s == n) return n + 1ll;
// if(s > (b - 1) + (b - 1)) return -1;
long long res = LONG_LONG_MAX;
for(long long k1 = 1; k1 < b; k1 ++){
if(n + k1 - s > 0 && (n + k1 - s) % k1 == 0){
long long k2 = s - k1, tb = (n + k1 - s) / k1;
if(k1 < tb && k2 < tb){
assert(sum(n, tb) == s);
res = min(res, tb);
}
}
}
return res == LONG_LONG_MAX ? -1 : res;
}
private:
long long sum(long long n, long long b){
long long res = 0ll;
while(n){
res += n % b;
n /= b;
}
return res;
}
};
|
a.cc: In member function 'long long int Solution::minbase(long long int, long long int)':
a.cc:11:9: error: 'assert' was not declared in this scope
11 | assert(b * b > n);
| ^~~~~~
a.cc:1:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
+++ |+#include <cassert>
1 | class Solution{
a.cc:16:25: error: 'LONG_LONG_MAX' was not declared in this scope
16 | long long res = LONG_LONG_MAX;
| ^~~~~~~~~~~~~
a.cc:22:27: error: 'min' was not declared in this scope
22 | res = min(res, tb);
| ^~~
|
s233047529
|
p04014
|
C++
|
#include <iostream>
#include <cstdio>
using namespace std;
class Solution{
public:
long long minbase(long long n, long long s){
if(s == 1ll) return n;
long long b;
for(b = 2ll; b * b <= n; b ++)
if(sum(n, b) == s) return b;
assert(b * b > n);
if(s > (b - 1) + (b - 1)) return -1;
long long res = n;
for(long long k2 = 0; k2 < b; k2 ++){
if(s - k2 > 0 && (n - k2) % (s - k2) == 0){
long long k1 = s - k2, tb = (n - k2) / (s - k2);
if(k1 < tb && k2 < tb) res = min(res, tb);
}
}
return res;
}
private:
long long sum(long long n, long long b){
long long res = 0ll;
while(n){
res += n % b;
n /= b;
}
return res;
}
};
int main() {
// cout << Solution().minbase(87654ll, 30ll) << endl;
// // 10
//
// cout << Solution().minbase(87654ll, 138ll) << endl;
// // 100
//
// cout << Solution().minbase(87654ll, 45678ll) << endl;
// // -1
//
// cout << Solution().minbase(31415926535ll, 1ll) << endl;
// // 31415926535
//
// cout << Solution().minbase(1ll, 31415926535ll) << endl;
// // -1
long long n, s;
scanf("%lld%lld", &n, &s);
printf("%lld\n", Solution().minbase(n, s));
return 0;
}
|
a.cc: In member function 'long long int Solution::minbase(long long int, long long int)':
a.cc:17:9: error: 'assert' was not declared in this scope
17 | assert(b * b > n);
| ^~~~~~
a.cc:3:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
2 | #include <cstdio>
+++ |+#include <cassert>
3 |
|
s755306969
|
p04014
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair<int,int>
#define fi first
#define sc second
#define all(x) (x).begin(),(x).end()
#include <conio.h>
int f(int b, int n) {
if (b > n) return n;
return f(b, n / b) + n % b;
}
void solve() {
int n, s;
cin >> n >> s;
for (int i = 2; i * i <= n; i++) {
if (f(i, n) == s) {
cout << i << '\n';
return;
}
}
for (int i = 1; i * i <= n - s; i++) {
if ((n - s) % i == 0 && f((n - s) / i + 1, n) == s) {
cout << (n - s) / i + 1 << '\n';
return;
}
}
cout << -1 << '\n';
}
signed main() {
#ifdef _DEBUG
// freopen("in" , "r", stdin );
// freopen("out", "w", stdout);
#endif
// ios::sync_with_stdio(0); cin.tie(0);
int T = 1;
// cin >> T;
while (T--) solve();
}
|
a.cc:12:10: fatal error: conio.h: No such file or directory
12 | #include <conio.h>
| ^~~~~~~~~
compilation terminated.
|
s164985744
|
p04014
|
C++
|
//ヘッダー
#include<bits/stdc++.h>
using namespace std;
//型定義
typedef long long ll;
//定数
const int INF=1e+9;
const int MOD=1e+9+7;
//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値
ll f(ll b, ll n){
ll res;
if(n==0) return 0;
if(n<b) return n;
res=f(b,n/b)+n%b;
return res;
}
int main(){
ll n,s;
cin>>n>>s;
if(s>(n+1)/2) cout<<-1<<endl;
else{
REP2(i,2,sqrt(n)+1){
if(f(i,n)==s){
cout<<i<<endl;
return 0;
}
}
REP2(i,1,sqrt(n)+1){
if((n-s)%i==0){
ll b=(n-s)/i+1;
if(n>sqrt(b,2)) continue;
cout<<b<<endl;
return 0;
}
}
}
}
|
a.cc: In function 'int main()':
a.cc:57:26: error: no matching function for call to 'sqrt(ll&, int)'
57 | if(n>sqrt(b,2)) continue;
| ~~~~^~~~~
In file included from /usr/include/c++/14/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
from a.cc:2:
/usr/include/c++/14/bits/valarray_after.h:458:5: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_UnClos<std::_Sqrt, std::_ValArray, _Tp>, _Tp> std::sqrt(const valarray<_Tp>&)'
458 | _DEFINE_EXPR_UNARY_FUNCTION(sqrt, struct std::_Sqrt)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:458:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/valarray_after.h:458:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_UnClos<std::_Sqrt, std::_Expr, _Dom>, typename _Dom::value_type> std::sqrt(const _Expr<_Dom1, typename _Dom1::value_type>&)'
458 | _DEFINE_EXPR_UNARY_FUNCTION(sqrt, struct std::_Sqrt)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:458:5: note: candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:1195:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::sqrt(const complex<_Tp>&)'
1195 | sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z.__rep()); }
| ^~~~
/usr/include/c++/14/complex:1195:5: note: candidate expects 1 argument, 2 provided
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:114:
/usr/include/c++/14/cmath:454:5: note: candidate: 'template<class _Tp> constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::sqrt(_Tp)'
454 | sqrt(_Tp __x)
| ^~~~
/usr/include/c++/14/cmath:454:5: note: candidate expects 1 argument, 2 provided
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:176:1: note: candidate: 'double sqrt(double)'
176 | __MATHCALL (sqrt,, (_Mdouble_ __x));
| ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:176:1: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/cmath:446:3: note: candidate: 'constexpr long double std::sqrt(long double)'
446 | sqrt(long double __x)
| ^~~~
/usr/include/c++/14/cmath:446:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/cmath:442:3: note: candidate: 'constexpr float std::sqrt(float)'
442 | sqrt(float __x)
| ^~~~
/usr/include/c++/14/cmath:442:3: note: candidate expects 1 argument, 2 provided
|
s515682111
|
p04014
|
C++
|
//ヘッダー
#include<bits/stdc++.h>
using namespace std;
//型定義
typedef long long ll;
//定数
const int INF=1e+9;
const int MOD=1e+9+7;
//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値
ll f(ll b, ll n){
ll res;
if(n==0) return 0;
if(n<b) return n;
res=f(b,n/b)+n%b;
return res;
}
int main(){
ll n,s;
cin>>n>>s;
if(s>(n+1)/2) cout<<-1<<endl;
else{
REP2(i,2,sqrt(n)+1){
if(f(i,n)==s){
cout<<i<<endl;
return 0;
}
}
REP2(i,1,sqrt(n)+1){
if((n-s)%p==0){
cout<<(n-2)/p+1<<endl;
return 0;
}
}
}
}
|
a.cc: In function 'int main()':
a.cc:55:22: error: 'p' was not declared in this scope
55 | if((n-s)%p==0){
| ^
|
s188629717
|
p04014
|
C++
|
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
ll f(ll b, ll n){
if(n == 0) return 0;
return f(b, n/b) + (n%b);
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll n,s,d;
cin >> n >> s;
d = n-s;
if(d < 0){
cout << -1 << endl;
return 0;
}
if(d==0){
cout << n+1 << endl;
return 0;
}
for(ll b=2;b*b<=n;b++){
if(f(b,n) == s){
cout << b << endl;
return 0;
}
}
ll ans = INF;
for(ll p=1;p*p<n;p++){
if(d%p==0 && d/i>0){
ll b=d/p+1;
if(f(b,n) == s) ans = min(ans,b);
}
}
if(ans == INF) ans=-1;
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:46:20: error: 'i' was not declared in this scope
46 | if(d%p==0 && d/i>0){
| ^
|
s516833592
|
p04014
|
C++
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll f(ll b, ll n){
if (b == 1) return -1;
else if (n < b) return n;
else return f(b,n/b) + n % b;
}
ll ma(vector<ll> ANS){
if(ANS.size()==0) return -1;
ll ans=1000000000000;
for (ll i: ANS) ans=min(ans,i);
return ans;
}
ll gcd(ll a, ll b)
{return b==0 ? a : gcd(b,a%b);}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
ll n,s;
ll ans=1000000000000;
cin >> n >> s;
if (n==s) cout<<n+1<<endl;
else{
for (int i=1; i*i<=n-s; i++){
if ((n-s)%i==0){
if (f(i+1,n)==s) ans=min(ans,i+1);
if (f(n/i+1,n)==s) ans=min(ans,n/i+1);
}
}
if (ans==1000000000000) ans=-1;
cout<<ans<<endl;
}
}
|
a.cc: In function 'int main()':
a.cc:34:33: error: no matching function for call to 'min(ll&, int)'
34 | if (f(i+1,n)==s) ans=min(ans,i+1);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:34:33: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
34 | if (f(i+1,n)==s) ans=min(ans,i+1);
| ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:34:33: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
34 | if (f(i+1,n)==s) ans=min(ans,i+1);
| ~~~^~~~~~~~~
|
s849324015
|
p04014
|
C++
|
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
#define MODSIZE 1000000007
ll f(ll b, ll n){
ll ans = 0;
while(n > 0){
ans += n % b;
n /= b;
}
return ans;
}
int main(){
ll n,s;
scanf("%lld", &n);
scanf("%lld", &s);
ll i = 2;
int f = 0;
ll ans;
if(s > n){
printf("-1\n");
return 0;
}
if(s == n){
printf("%lld", n + 1);
return 0;
}
for(i = 2;i*i <= n;i++){
if(f(i,n) == s){
printf("%lld\n", i);
return 0;
}
}
ll t = n - s;
ll ans = -1;
for(i = 1;i*i < n;i++){
ll b = t/i + 1;
if(b >= 2 && f(b,n) == s) ans = b;
}
printf("%lld\n", ans);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:38:9: error: 'f' cannot be used as a function
38 | if(f(i,n) == s){
| ~^~~~~
a.cc:45:6: error: redeclaration of 'll ans'
45 | ll ans = -1;
| ^~~
a.cc:25:6: note: 'll ans' previously declared here
25 | ll ans;
| ^~~
a.cc:50:19: error: 'f' cannot be used as a function
50 | if(b >= 2 && f(b,n) == s) ans = b;
| ~^~~~~
|
s909559510
|
p04014
|
C++
|
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
#define MODSIZE 1000000007
int main(){
ll n,s;
ll t;
scanf("%lld", &n);
scanf("%lld", &s);
int i = 2;
int f = 0;
ll ans;
if(s == n){
printf("%lld", n + 1);
return 0;
}
int limit;
limit = sqrt(n);
while(1){
t = n;
ans = 0;
while(t > 0){
ans += t % i;
t /= i;
}
if(ans == s){
f = 1;
break;
}
i++;
if(i > limit) break;
}
if(f == 1){
printf("%lld\n", i);
return 0;
}
ll b;
int i = 1;
while(1){
ans = 0;
t = n;
b = (n - s)/i + 1;
while(b > 0){
ans += t % b;
t /= b;
}
if(ans == s){
f = 1;
break;
}
i++;
if(i > limit) break;
}
if(f == 1) printf("%lld\n", b);
else printf("-1\n");
return 0;
}
|
a.cc: In function 'int main()':
a.cc:49:7: error: redeclaration of 'int i'
49 | int i = 1;
| ^
a.cc:14:7: note: 'int i' previously declared here
14 | int i = 2;
| ^
|
s623942313
|
p04014
|
C++
|
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;
ll digitsum(ll n, ll b)
{
int y = log(n)/log(b) +1;
ll ans = 0;
for(int i = 0; i<y; i++)
{
ans += n%b;
n /= b;
}
return ans;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
ll n, s;
cin>>n>>s;
if(s>n)
{
cout<<-1<<endl;
return 0;
}
ll ans = -1;
for(int i = 2; i<=sqrt(n); i++)
{
ll y = digitsum(n,i);
if(y==s)
{
cout<<i<<endl;
return 0;
}
}
n-=s;
for(ll i = 1; i<=sqrt(n); i++)
{
if(n%i==0)
{
y = digitsum(n+s,n/i+1);
if(y==s)
ans = n/i+1;
}
}
cout<<ans<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:47:25: error: 'y' was not declared in this scope
47 | y = digitsum(n+s,n/i+1);
| ^
|
s229814419
|
p04014
|
C++
|
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include <functional>
#include <set>
#include <map>
#include <queue>
#include <math.h>
#include <stack>
using namespace std;
int cou(long long int a,long long int b) {
if (a > b) {
return b;
}
else {
return cou(a, b / a) + b % a;
}
}
int main() {
long long int n, s;
cin >> n;
cin >> s;
if (s == n) {
cout << n + 1;
return 0;
}
if (s > n) {
cout << "-1";
return 0;
}
int y = sqrt(n);
for (int i = 2; i < y + 1; i++) {
if (cou(i, n) == s&) {
cout << i;
return 0;
}
}
for (int i = y; i >0; i--) {
if ((n - s) % i != 0)continue;
long long int a = (n - s) / i + 1;
if (cou(a, n) == s&&a>1) {
cout << a;
return 0;
}
}
cout << "-1";
}
|
a.cc: In function 'int main()':
a.cc:38:36: error: expected primary-expression before ')' token
38 | if (cou(i, n) == s&) {
| ^
|
s152090348
|
p04014
|
C++
|
// wakaran
|
/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
|
s681688226
|
p04014
|
C++
|
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpii = vector<pll>;
ll func(ll b, ll m){
if(m < b){
return m;
} else{
return func(b, m / b) + (m % b);
}
}
int main(){
ll n, s;
cin >> n >> s;
if(n < s){
cout << -1 << endl;
return 0;
} else if(n == s){
cout << n + 1 << endl;
return 0;
}
ll sqn = 1;
while(sqn * sqn < n) sqn++;
rep2(b, 2, sqn + 1){
if(func(b, n) == s){
cout << b << endl;
return 0;
}
}
rep_inv(a1, sqn, 0){
if((n - s) % b != 0) continue;
ll b = (n - s) / a1 + 1;
if(func(b, n) == s){
cout << b << endl;
return 0;
}
}
cout << -1 << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:45:18: error: 'b' was not declared in this scope
45 | if((n - s) % b != 0) continue;
| ^
|
s367466815
|
p04014
|
C++
|
#include <bits/stdc++.h>
using namespace std;
long long f(long long b, long long n) {
if (n < b) {
return n;
}
else {
return f(b, n/b) + n%b;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long n, s;
cin >> n >> s;
if (n == s) {
cout << n+1 << '\n';
return 0;
}
for (long long b = 2; b*b <= n; b++) {
if (f(b, n) == s) {
cout << b << '\n';
return 0;
}
}
for (long long p = 1; p*p <= n; p++) {
if ((n-q) % p != 0) {
continue;
}
long long q = s - p;
long long b = (n-s) / p + 1;
if (b >= 2 && q >= 0 && f((n - q) / p, n) == s) {
cout << (n - q) / p << '\n';
return 0;
}
}
cout << "-1\n";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:34:24: error: 'q' was not declared in this scope
34 | if ((n-q) % p != 0) {
| ^
|
s668082583
|
p04014
|
C++
|
#include <bits/stdc++.h>
using namespace std;
long long f(long long b, long long n) {
if (n < b) {
return n;
}
else {
return f(b, n/b) + n%b;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long n, s;
cin >> n >> s;
if (n == s) {
cout << n+1 << '\n';
return 0;
}
for (long long b = 2; b*b <= n; b++) {
if (f(b, n) == s) {
cout << b << '\n';
return 0;
}
}
for (long long p = 1; p*p <= n; p++) {
long long q = s - p;
if (q >= 0 && (n-q) % p == 0 && (n-q) / p >= 2 && p*b + q == n && f((n - q) / p, n) == s) {
cout << (n - q) / p << '\n';
return 0;
}
}
cout << "-1\n";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:35:69: error: 'b' was not declared in this scope
35 | if (q >= 0 && (n-q) % p == 0 && (n-q) / p >= 2 && p*b + q == n && f((n - q) / p, n) == s) {
| ^
|
s644448475
|
p04014
|
C++
|
include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>
#include<list>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
const int BIG_INT = 1000000000;
ll dig_sum(ll b, ll n) {
if (b > n) {
return n;
}
return (n%b) + dig_sum(b, n / b);
}
int main() {
ll n, s;
cin >> n >> s;
if (s == n) {
cout << n + 1 << endl;
}
else {
bool isExist = false;
for (ll i = 2; i * i <= n;i++) {
if (dig_sum(i, n) == s) {
isExist = true;
cout << i << endl;
break;
}
}
if (!isExist && n > s) {
ll min_b = BIG_NUM;
for (ll i = 1; i*i < n && i <= n-s;i++) {
ll b = (n - s) / i + 1;
if (b < sqrt(n)) {
break;
}
if (dig_sum(b, n) == s) {
isExist = true;
min_b = b;
}
}
if (isExist) {
cout << min_b << endl;
}
}
if (!isExist) {
cout << -1 << endl;
}
}
}
|
a.cc:1:1: error: 'include' does not name a type
1 | include <iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from a.cc:2:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/char_traits.h:50:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared
144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type
146 | static _GLIBCXX14_CONSTEXPR std::size_t
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared
150 | find(const char_type* __s, std::size_t __n, const char_type& __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared
153 | move(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared
156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared
159 | assign(char_type* __s, std::size_t __n, char_type __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared
187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n)
| ^~~
/usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)':
/usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~
| __n
/usr/include/c++/14/bits/char_traits.h: At global scope:
/usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std' does not name a type
198 | _GLIBCXX14_CONSTEXPR std::size_t
|
|
s570812326
|
p04014
|
C++
|
#include <iostream>
#include <algorithm>
using namespace std;
long long calc_sum(long long n, long long b) {
if (n < b) return n;
return calc_sum(n / b, b) + n % b;
}
int main()
{
long long n, s;
cin >> n >> s;
// 2≦b<sqrt(n)
// sqrt(n)≦b≦n
// b=n+1
long long ans = -1;
long long sqrt_n = (long long)sqrt((double)n);
if (n == s) {
// b=n+1 先にわかる
ans = n + 1;
} else {
// 2≦b<sqrt(n)ここまで全探索
for (long long i = 2; i < sqrt_n; i++) {
if (s == calc_sum(n, i)) {
ans = i;
break;
}
}
// sqrt(n)≦b≦n 二つの和になる
// s1+s2=s s1+s2*b=n
// => s2*(b-1)=n-s ただし、max(1,s-b)≦s2≦min(sqrt(n),s)かつsqrt(n)≦b≦n
if (-1 == ans) {
long long range = min(sqrt_n, s);
long long n_s = n - s;
for (long long i = range; i >= 1; i--) {
if (n_s % i) continue;//bが整数にならない
long long ans_tmp = n_s / i + 1;
if (s - ans_tmp > i)continue;//max(1,s-b)≦s2不成立
if (sqrt_n <= ans_tmp && ans_tmp <= n) {
ans = ans_tmp;
break;
}
}
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:21:39: error: 'sqrt' was not declared in this scope; did you mean 'sqrt_n'?
21 | long long sqrt_n = (long long)sqrt((double)n);
| ^~~~
| sqrt_n
|
s806098506
|
p04014
|
C++
|
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
using namespace std;
/*-----------------------------------------------------------------------------
定義
-------------------------------------------------------------------------------*/
#define ALL(x) (x).begin(),(x).end()
#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF 2e9
#define MOD (1000 * 1000 * 1000 + 7)
#define Ceil(x, n) (((((x))+((n)-1))/n)) /* Nの倍数に切り上げ割り算 */
#define CeilN(x, n) (((((x))+((n)-1))/n)*n) /* Nの倍数に切り上げ */
#define FloorN(x, n) ((x)-(x)%(n)) /* Nの倍数に切り下げ */
#define IsOdd(x) (((x)&0x01UL) == 0x01UL)
#define IsEven(x) (!IsOdd((x)))
#define M_PI 3.14159265358979323846
typedef long long ll;
typedef pair<ll, ll> P;
/*-----------------------------------------------------------------------------
処理
-----------------------------------------------------------------------------*/
/* 約数の列挙 */
vector<ll> divisorExec(ll n)
{
vector<ll> res;
for(ll i = 1; i <= sqrt(n); i++){
if ((n % i) == 0) {
res.push_back(i);
if ((i * i) != n) {
res.push_back(n / i);
}
}
}
sort(res.begin(), res.end());
return res;
}
/* 素因数分解 */
map<ll, ll> factMap;
void primeFactor(ll n)
{
if ((n % 2) == 0){
while((n % 2) == 0) {
factMap[2]++;
n = n / 2;
}
}
for(ll i = 3; i <= sqrt(n); i += 2){
while ((n % i) == 0){
factMap[i]++;
n = n / i;
}
}
if (n != 1) {
factMap[n]++;
}
}
ll compExec(ll n, ll s, ll mid)
{
ll ans = 0;
if (mid == 1) {
return n;
}
while (0 != n) {
ans += n % mid;
n /= mid;
}
return ans;
}
int main()
{
ll n, s;
cin >> n >> s;
vector<ll> yakusu = divisorExec(n);
auto idx = lower_bound(ALL(yakusu), s) - yakusu.begin();
if (yakusu[idx] == s) {
cout << << endl;
} else {
cout << compExec(n, s, i + 1) << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:99:26: error: expected primary-expression before '<<' token
99 | cout << << endl;
| ^~
a.cc:101:40: error: 'i' was not declared in this scope
101 | cout << compExec(n, s, i + 1) << endl;
| ^
|
s084657738
|
p04014
|
C
|
long n,s;
f(long b)
{
long sum=0;
long _n=n;
while(_n)
{
sum+=_n%b;
_n/=b;
}
return sum==s;
}
main()
{
scanf("%ld%ld",&n,&s);
if(n==s)
{
printf("%ld\n",n+1);
return 0;
}
for(long i=2;i*i<=n;i++)
if(f(i))
{
printf("%ld\n",i);
return 0;
}
long minb=n+1;
for(long i=1;i*i<=n;i++)
{
long b=(n-s)/i+1;
if(b>1&&f(b))
{
minb=min(minb,b);
}
}
printf("%ld\n",minb==n+1?-1:minb);
}
|
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
2 | f(long b)
| ^
main.c:13:1: error: return type defaults to 'int' [-Wimplicit-int]
13 | main()
| ^~~~
main.c: In function 'main':
main.c:15:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
15 | scanf("%ld%ld",&n,&s);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | long n,s;
main.c:15:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
15 | scanf("%ld%ld",&n,&s);
| ^~~~~
main.c:15:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:18:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
18 | printf("%ld\n",n+1);
| ^~~~~~
main.c:18:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:18:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:18:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:24:25: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
24 | printf("%ld\n",i);
| ^~~~~~
main.c:24:25: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:33:30: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
33 | minb=min(minb,b);
| ^~~
| main
main.c:36:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
36 | printf("%ld\n",minb==n+1?-1:minb);
| ^~~~~~
main.c:36:9: note: include '<stdio.h>' or provide a declaration of 'printf'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.