submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s643489911
p04034
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<bits/stdc++.h> #include<cmath> #include<bitset> #include<queue> #define ll long long #define itn int #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define FFOR(i,a,b) for(int i=(a);i<=(b);++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) FFOR(i,1,n) #define SORT(V) sort((V).begin(),(V).end()) #define REVERSE(V) reverse((V).begin(),(V).end()) #define INF ((1LL<<62)-(1LL<<31)) #define MOD 1000000007 using namespace std; int N,M,K,A,B,C,ans=0,cnt=0; string S,T; vector<int> P,Q; vector<pair<int,int>> PP; bool CAN=false; int main(){ cin>>N>>M; int X[M+1],Y[M+1],num[N+1]; bool red[N+1]; RREP(i,N){ num[i]=1; red[i]=false; } red[1]=true; RREP(i,M) cin>>X[i]>>Y[i]; RREP(i,M){ if(red[X[i]]){ red[Y[i]]=true; } else if{ num[X[i]]--; num[Y[i]]++; } if(num[X[i]]==0) red[X[i]]=false; } RREP(i,N) if(red[X[i]]) ans++; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:46:12: error: expected '(' before '{' token 46 | else if{ | ^ | (
s038641248
p04034
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<bits/stdc++.h> #include<cmath> #include<bitset> #include<queue> #define ll long long #define itn int #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define FFOR(i,a,b) for(int i=(a);i<=(b);++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) FFOR(i,1,n) #define SORT(V) sort((V).begin(),(V).end()) #define REVERSE(V) reverse((V).begin(),(V).end()) #define INF ((1LL<<62)-(1LL<<31)) #define MOD 1000000007 using namespace std; int N,M,K,A,B,C,ans=0,cnt=0; string S,T; vector<int> P,Q; vector<pair<int,int>> PP; bool CAN=false; int main(){ cin>>N>>M; int X[M],Y[M],ANS[N+1]; REP(i,N+1) ANS[i]=0; ANS[i]=1; REP(i,M){ cin>>X[i]>>Y[i]; if(X[i]==1) Y[i]==1; } REP(i,N+1) ans+=ANS[i]; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:33:7: error: 'i' was not declared in this scope 33 | ANS[i]=1; | ^
s536043695
p04034
C++
#include<bits/stdc++.h> using namespace std; //#define int long long #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define fi first #define se second int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } int gcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return f; } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; double b=sqrt(a); for(int i=3;i<=b;i+=2){ if(a%i==0){ return false; } } return true; } signed main(){ int a,b,e,f; cin>>a>>b; vector<pair<int,int>> c(b),d(a,(1,0)); fo(i,a){ cin>>c[i].fi>>c[i].se; c[i].fi--; c[i].se--; } d[0].se=1; fo(i,b){ e=c[i].fi; f=c[i].se; if(d[e].se==1){ d[f].fi++; d[f].se=1; d[e].fi--; if(d[e].fi==0) d[e].se=0; } else{ d[e].fi--; d[f].fi++; } } int g=0; fo(i,a){ if(d[i].se==1) g++; } cout<<g<<endl; }
a.cc: In function 'int main()': a.cc:78:39: error: no matching function for call to 'std::vector<std::pair<int, int> >::vector(int&, int)' 78 | vector<pair<int,int>> c(b),d(a,(1,0)); | ^ 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::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >]' 707 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_algobase.h:65, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _InIter> using std::_RequireInputIter = std::__enable_if_t<((bool)std::is_convertible<typename std::iterator_traits< <template-parameter-1-1> >::iterator_category, std::input_iterator_tag>::value)> [with _InIter = int]': /usr/include/c++/14/bits/stl_vector.h:705:9: required from here 705 | typename = std::_RequireInputIter<_InputIterator>> | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:252:57: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>' 252 | input_iterator_tag>::value>; | ^~~~~ /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::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; allocator_type = std::allocator<std::pair<int, 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::pair<int, 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::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::__type_identity_t<_Alloc> = std::allocator<std::pair<int, 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::pair<int, 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::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; allocator_type = std::allocator<std::pair<int, 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::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; allocator_type = std::allocator<std::pair<int, 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::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::__type_identity_t<_Alloc> = std::allocator<std::pair<int, 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::pair<int, 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::pair<int, int>; _Alloc = std::allocator<std::pair<int, 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::pair<int, int>; _Alloc = std::allocator<std::pair<int, 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::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; size_type = long unsigned int; value_type = std::pair<int, int>; allocator_type = std::allocator<std::pair<int, 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 'int' to 'const std::vector<std::pair<int, int> >::value_type&' {aka 'const std::pair<int, 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::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; size_type = long unsigned int; allocator_type = std::allocator<std::pair<int, 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 'int' to 'const std::vector<std::pair<int, int> >::allocator_type&' {aka 'const std::allocator<std::pair<int, 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::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; allocator_type = std::allocator<std::pair<int, 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::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >]' 531 | vector() = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
s739637136
p04034
C++
#pragma GCC optimize ("O3") #include <bits/stdc++.h> #ifdef ONLINE_JUDGE #define LLD "%I64d" #else #define LLD "%lld" #endif #define fu(a,b,c) for(int a=b;a<=(int)c;++a) #define fd(a,b,c) for(int a=b;a>=(int)c;--a) #define cu(a,b,c) for(int a=b;a<(int)c;++a) #define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a) #define gcd(a,b) __gcd(a,b) #define pii pair<int,int> #define pll pair<long long,long long> #define all(a) a.begin(),a.end() #define F first #define S second #define pb push_back #define pf push_front #define uint unsigned int #define MOD 998244353 #define MAXN 200005 #define MAXH 4 #define MAXM 100 #define INF 1LL << 30 #define ll long long #define ull unsigned long long #define RNG mt19937 #define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b) #define max3(a,b,c) max(a, max(b, c)) #define min3(a,b,c) min(a, min(b, c)) #define gmax(a,b) a = max(a, b) #define gmin(a,b) a = min(a, b) #define whatis(x) cerr << #x << " is " << x << endl; #define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define T int #define PI 3.1415926535897932384626433 using namespace std; int main(){ fast_io(); int n,m;cin >> n >> m; bool b[n + 1] = {}; int cnt[n + 1] = {}; b[1] = 1; fu(i,1,n)cnt[i] = 1; while(m--){ int x,y; cin >> x >> y; if(cnt[x] == 1){ if(b[x] == 1){ b[y] = 1; b[x] = 0; } --cnt[x]; ++cnt[y]; } else{ if(b[x] == 1){ b[y] = 1; } --cnt[x]; --cnt[y]; } } int res = 0; int res = accumulate(b+1,b+n+1,res); cout << res << '\n'; }
a.cc: In function 'int main()': a.cc:67:13: error: redeclaration of 'int res' 67 | int res = accumulate(b+1,b+n+1,res); | ^~~ a.cc:66:13: note: 'int res' previously declared here 66 | int res = 0; | ^~~
s148938071
p04034
C++
#include <iostream> #include <cmath> #include <string> #include <vector> #include <algorithm> #include <queue> #include <map> #include <set> using namespace std; #define MOD 1000000007 #define INF 1<<30 #define LINF (ll)1<<62 #define rep(i,n) for(ll i=0; i<(n); i++) #define REP(i,a,b) for(ll i=(a); i<(b); i++) #define all(x) (x).begin(),(x).end() using namespace std; typedef long long ll; typedef vector<ll> vl; typedef vector<vl> vvl; typedef pair<ll, ll> P; typedef vector<pair<ll, ll>> vpl; #define MAX 3000 int main(){ ll n,m; cin >> n >> m; vl x(m), y(m); rep(i,m) cin >> x[i] >> y[i]; vl box(n, 1); set<ll> red; red.insert(1); rep(i,m){ if(red.find(x[i]) != red.end()){ if(box[x[i]] == 1) red.erase(x[i]); if(red.find(y[i]) == red.end()) red.insert(y[i]); r = y[i]; } box[x[i]]--; box[y[i]]++; if(box[x[i]] == 0){ if(red.find(x[i]) != red.end()) red.erase(x[i]); } } cout << red.size() << endl; }
a.cc: In function 'int main()': a.cc:35:13: error: 'r' was not declared in this scope 35 | r = y[i]; | ^
s207530666
p04034
Java
import java.util.Scanner; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author Jiakang Chen */ public class AGC_002B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); Box[] B = new Box[N]; B[0] = new Box(1, true); for (int i = 1; i < N; i++) { B[i] = new Box(1, false); } for (int i = 0; i < M; i++) { int x = sc.nextInt() - 1; int y = sc.nextInt() - 1; B[x].moveTo(B[y]); } int counter = 0; for (Box b : B) { if (b.red) { counter++; } } System.out.println(counter); } } class Box { public int num; public boolean red; public Box(int n, boolean r) { num = n; red = r; } public void moveTo(Box other) { if (num == 0) { return; } else if (num == 1) { num = 0; other.num++; if (red) { other.red = true; } red = false; } else { num--; other.num++; if (red) { other.red = true; } } } }
Main.java:14: error: class AGC_002B is public, should be declared in a file named AGC_002B.java public class AGC_002B { ^ 1 error
s040559743
p04034
C++
#include <iostream> #include <vector> #include <queue> struct edge{ int to; long long cost; }; using namespace std; //ダイクストラで多用する型 typedef pair<long long, int> P;//(その頂点までの距離,頂点)として使う。 vector<edge> G[100000];//頂点iから出る辺の配列G[i]の配列。 vector<int> dist(100000,-1);//特定の頂点から各頂点への距離が格納される。 bool used[100000];//dijkstra実行中に、頂点iまでの距離を確定したかどうかを持つ。 void dijkstra(int v){//vは始点。 //以下のリンクでpriority_queueの使い方を参照 //http://shirokurostone.hatenablog.com/entry/20110522/1306052844 priority_queue<P, vector<P>, greater<P>> que; que.push(P(0, v)); while(!que.empty()){ P top = que.top(); que.pop(); int u = top.second; long long d = top.first; //cout << u << ' ' << d << endl; if(used[u]) continue; dist[u] = d; used[u] = true; for(int i = 0; i < G[u].size(); i++){ if(!used[G[u][i].to]){ que.push(P(d+G[u][i].cost, G[u][i].to)); //cout << G[u][i].to << ' ' << d+G[u][i].cost << endl; } } } } int main(){ int n,m; cin>>n>>m; int x,y; REP(i,m){ cin>>x>>y; x--;y--; G[x].push_back(edge{y, 1}); } dijkstra(1); int cnt=0; REP(i,n){ if(dist[i]>=0){ cnt++; } } cout<<cnt<<endl; }
a.cc: In function 'int main()': a.cc:46:7: error: 'i' was not declared in this scope 46 | REP(i,m){ | ^ a.cc:46:3: error: 'REP' was not declared in this scope 46 | REP(i,m){ | ^~~
s414869610
p04034
C++
#include <bits/stdc++.h> using namespace std; int main(void){ int n,m,i,x,y,ans=1; cin >> n >> m; vector<int> box(n+5,1); vector<bool> can(n+5,false); can.at(1)=true; for (i=0;i<m;i++){ cin >> x >> y; box.at(x)--; box.at(y)++; if (!can.at(y)){ can.at(y)=true; ans++; } if (box.at(x)==0){ can.at(x)=false; ans--; } } cout << ans << endl; return 0;
a.cc: In function 'int main()': a.cc:23:12: error: expected '}' at end of input 23 | return 0; | ^ a.cc:3:15: note: to match this '{' 3 | int main(void){ | ^
s459247666
p04034
C++
#include <bits/stdc++.h> using namespace std; #define lli long long int #define REP(i,s,l) for(lli i=s;i<l;i++) #define DEBUG 0 #define INF (1LL<<50) signed main(){ lli n,m; cin>>n>>m; lli flag[100100]; lli boal[100100]; REP(i,0,100100){ flag[i]=0; boal[i]=1; } flag[0]=1; REP(i,0,m){ lli x,y; cin>>x>>y; x--;y--; if(flag[x]==1) flag[y]=1; boal[x]--; boal[y]++; if(boal[x]==0) flag[x]=0; } lli sum=0; REP(i,0,n){ sum+=flag[i]; cout<<sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:40:2: error: expected '}' at end of input 40 | } | ^ a.cc:10:14: note: to match this '{' 10 | signed main(){ | ^
s638756454
p04034
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N, M; cin >> N >> M; //玉の数の配列を作る vector<int> tama(N,1); //赤が入っている確率のある箱の番号に1、そうでない箱に0をつける配列を作る vector<int> kakuritu(N,0); kakuritu[0] = 1; for(int i = 0; i < M; i++){ cin >> x >> y; //球を動かす tama[x-1]--; tama[y-1]++; //kakuritu[x-1]が1ならkakuritu[y-1]を1に if(kakuritu[x-1] == 1){ kakuritu[y-1] = 1; } //もしそれでtama[x-1]の玉の個数が0になったらkakuritu[x-1]を0にする if(tama[x-1] == 0){ kakuritu[x-1] = 0; } } int count = 0; //1の数を数える for(int i = 0; i < N; i++){ if(kakuritu[i] == 1){ count++; } } cout << count << endl; }
a.cc: In function 'int main()': a.cc:14:12: error: 'x' was not declared in this scope 14 | cin >> x >> y; | ^ a.cc:14:17: error: 'y' was not declared in this scope 14 | cin >> x >> y; | ^
s011100035
p04034
C++
#include <iostream>using namespace std;int main() { int n, m, x, y; cin >> n >> m; bool red[n + 5]; red[1] = true; int count[n + 5]; for(int i = 1; i <= n; i++) count[i] = 1; for (int i=2;i<=n;i++)red[i]=false; for (int i = 1; i <= m; i++) { cin >> x >> y; count[x]--; count[y]++; if(red[x]) red[y] = true; if(count[x] == 0) red[x] = false; } int ans = 0; for(int i = 1; i <= n; i++) { if(red[i]) ans++; } cout << ans << endl;}
a.cc:1:26: warning: extra tokens at end of #include directive 1 | #include <iostream>using namespace std;int main() { int n, m, x, y; cin >> n >> m; bool red[n + 5]; red[1] = true; int count[n + 5]; for(int i = 1; i <= n; i++) count[i] = 1; for (int i=2;i<=n;i++)red[i]=false; for (int i = 1; i <= m; i++) { cin >> x >> y; count[x]--; count[y]++; if(red[x]) red[y] = true; if(count[x] == 0) red[x] = false; } int ans = 0; for(int i = 1; i <= n; i++) { if(red[i]) ans++; } cout << ans << endl;} | ^~~~~~~~~ a.cc:1:10: fatal error: iostream>usin: No such file or directory 1 | #include <iostream>using namespace std;int main() { int n, m, x, y; cin >> n >> m; bool red[n + 5]; red[1] = true; int count[n + 5]; for(int i = 1; i <= n; i++) count[i] = 1; for (int i=2;i<=n;i++)red[i]=false; for (int i = 1; i <= m; i++) { cin >> x >> y; count[x]--; count[y]++; if(red[x]) red[y] = true; if(count[x] == 0) red[x] = false; } int ans = 0; for(int i = 1; i <= n; i++) { if(red[i]) ans++; } cout << ans << endl;} | ^~~~~~~~~~~~~~~ compilation terminated.
s140610912
p04034
C++
#include <iostream>using namespace std;int main() { int n, m, x, y; cin >> n >> m; bool red[n + 5]; red[1] = true; int count[n + 5]; for(int i = 1; i <= n; i++){ count[i] = 1; red[i]=false;} red[i]=true; for (int i = 1; i <= m; i++) { cin >> x >> y; count[x]--; count[y]++; if(red[x]) red[y] = true; if(count[x] == 0) red[x] = false; } int ans = 0; for(int i = 1; i <= n; i++) { if(red[i]) ans++; } cout << ans << endl;}
a.cc:1:26: warning: extra tokens at end of #include directive 1 | #include <iostream>using namespace std;int main() { int n, m, x, y; cin >> n >> m; bool red[n + 5]; red[1] = true; int count[n + 5]; for(int i = 1; i <= n; i++){ count[i] = 1; red[i]=false;} red[i]=true; for (int i = 1; i <= m; i++) { cin >> x >> y; count[x]--; count[y]++; if(red[x]) red[y] = true; if(count[x] == 0) red[x] = false; } int ans = 0; for(int i = 1; i <= n; i++) { if(red[i]) ans++; } cout << ans << endl;} | ^~~~~~~~~ a.cc:1:10: fatal error: iostream>usin: No such file or directory 1 | #include <iostream>using namespace std;int main() { int n, m, x, y; cin >> n >> m; bool red[n + 5]; red[1] = true; int count[n + 5]; for(int i = 1; i <= n; i++){ count[i] = 1; red[i]=false;} red[i]=true; for (int i = 1; i <= m; i++) { cin >> x >> y; count[x]--; count[y]++; if(red[x]) red[y] = true; if(count[x] == 0) red[x] = false; } int ans = 0; for(int i = 1; i <= n; i++) { if(red[i]) ans++; } cout << ans << endl;} | ^~~~~~~~~~~~~~~ compilation terminated.
s065862791
p04034
C++
int n, m; cin >> n >> m; vector<int> r; int t1, t2; vector<int> v; r.push_back(1); v.push_back(1); for(int i = 1; i < n; i++){ r.push_back(0); v.push_back(1); } for(int i = 0; i < m; i++){ cin >> t1 >> t2; t1--; t2--; v[t1]--; v[t2]++; if(r[t1]==1){ if(v[t1]==0){ r[t1]=0; } r[t2]=1; } } int c=0; for(int i = 0; i < n; i++){ c += r[i]; } cout << c;
a.cc:2:1: error: 'cin' does not name a type 2 | cin >> n >> m; | ^~~ a.cc:3:1: error: 'vector' does not name a type 3 | vector<int> r; | ^~~~~~ a.cc:5:1: error: 'vector' does not name a type 5 | vector<int> v; | ^~~~~~ a.cc:6:1: error: 'r' does not name a type 6 | r.push_back(1); | ^ a.cc:7:1: error: 'v' does not name a type 7 | v.push_back(1); | ^ a.cc:8:1: error: expected unqualified-id before 'for' 8 | for(int i = 1; i < n; i++){ | ^~~ a.cc:8:16: error: 'i' does not name a type 8 | for(int i = 1; i < n; i++){ | ^ a.cc:8:23: error: 'i' does not name a type 8 | for(int i = 1; i < n; i++){ | ^ a.cc:12:1: error: expected unqualified-id before 'for' 12 | for(int i = 0; i < m; i++){ | ^~~ a.cc:12:16: error: 'i' does not name a type 12 | for(int i = 0; i < m; i++){ | ^ a.cc:12:23: error: 'i' does not name a type 12 | for(int i = 0; i < m; i++){ | ^ a.cc:26:1: error: expected unqualified-id before 'for' 26 | for(int i = 0; i < n; i++){ | ^~~ a.cc:26:16: error: 'i' does not name a type 26 | for(int i = 0; i < n; i++){ | ^ a.cc:26:23: error: 'i' does not name a type 26 | for(int i = 0; i < n; i++){ | ^ a.cc:29:1: error: 'cout' does not name a type 29 | cout << c; | ^~~~
s662878413
p04034
C++
int n, m; cin >> n >> m; vector<int> r; int t1, t2; vector<int> v; r.push_back(1); v.push_back(1); for(int i = 1; i < n; i++){ r.push_back(0); v.push_back(1); } for(int i = 0; i < m; i++){ cin >> t1 >> t2; t1--; t2--; v[t1]--; v[t2]++; if(r[t1]==1){ if(v[t1]==0){ r[t1]=0; } r[t2]=1; } /*for(int j = 0; j < n; j++){ cout << r[j] << " "; } cout << endl;*/ } int c=0; for(int i = 0; i < n; i++){ c += r[i]; } cout << c;
a.cc:2:5: error: 'cin' does not name a type 2 | cin >> n >> m; | ^~~ a.cc:3:5: error: 'vector' does not name a type 3 | vector<int> r; | ^~~~~~ a.cc:5:5: error: 'vector' does not name a type 5 | vector<int> v; | ^~~~~~ a.cc:6:5: error: 'r' does not name a type 6 | r.push_back(1); | ^ a.cc:7:5: error: 'v' does not name a type 7 | v.push_back(1); | ^ a.cc:8:5: error: expected unqualified-id before 'for' 8 | for(int i = 1; i < n; i++){ | ^~~ a.cc:8:20: error: 'i' does not name a type 8 | for(int i = 1; i < n; i++){ | ^ a.cc:8:27: error: 'i' does not name a type 8 | for(int i = 1; i < n; i++){ | ^ a.cc:12:5: error: expected unqualified-id before 'for' 12 | for(int i = 0; i < m; i++){ | ^~~ a.cc:12:20: error: 'i' does not name a type 12 | for(int i = 0; i < m; i++){ | ^ a.cc:12:27: error: 'i' does not name a type 12 | for(int i = 0; i < m; i++){ | ^ a.cc:30:5: error: expected unqualified-id before 'for' 30 | for(int i = 0; i < n; i++){ | ^~~ a.cc:30:20: error: 'i' does not name a type 30 | for(int i = 0; i < n; i++){ | ^ a.cc:30:27: error: 'i' does not name a type 30 | for(int i = 0; i < n; i++){ | ^ a.cc:33:5: error: 'cout' does not name a type 33 | cout << c; | ^~~~
s910385095
p04034
C++
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> using namespace std; /*BigInteger #include <boost/multiprecision/cpp_dec_float.hpp> #include <boost/multiprecision/cpp_int.hpp> #include <boost/rational.hpp> namespace xxx = boost::multiprecision; using Bint = xxx::cpp_int; using Real = xxx::number<xxx::cpp_dec_float<1024>>; */ #define int long long #define pb(x) push_back(x) #define m0(x) memset((x), 0LL, sizeof(x)) #define mm(x) memset((x), -1LL, sizeof(x)) //container #define ALL(x) (x).begin(), (x).end() #define RALL(a) (a).rbegin(), (a).rend() #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 UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end()); #define PERM(c) \ sort(ALL(c)); \ for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c))) // debug #define GET_VAR_NAME(variable) #variable #define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl; // bit_macro #define Bit(n) (1LL << (n)) #define Bitset(a, b) (a) |= (1LL << (b)) #define Bitunset(a, b) (a) &= ~(1LL << (b)) #define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL) #define Bitcount(a) __builtin_popcountll((a)) //typedef typedef long long lint; typedef unsigned long long ull; typedef complex<long double> Complex; typedef pair<int, int> P; typedef tuple<int, int, int> TP; typedef vector<int> vec; typedef vector<vec> mat; //constant constexpr int INF = (int)1e18; constexpr int MOD = (int)1e9 + 7; constexpr double PI = (double)acos(-1); constexpr double EPS = (double)1e-10; constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1}; constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1}; // template <typename T> void chmax(T &a, T b) { a = max(a, b); } template <typename T> void chmin(T &a, T b) { a = min(a, b); } // 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(); } // struct Accelerate_Cin { Accelerate_Cin() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(20); }; }; signed main() { int N, M; cin >> N >> M; vector<int> v(N, 1); v[0] *= -1; for (int i = 0; i < M; i++) { int x, y; cin >> x >> y; x--, y--; if (v[x] == 0) { continue; } else if (v[x] > 0) { v[x]--; if (v[y] < 0) {A v[y]--; } else { v[y]++; } } else if (v[x] < 0) { v[x]++; if (v[y] < 0) { v[y]--; } else { v[y]++; v[y] *= -1; } } } int ans = 0; for (int i = 0; i < N; i++) { if (v[i] < 0) ans++; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:100:22: error: 'A' was not declared in this scope 100 | if (v[y] < 0) {A | ^
s730227254
p04034
C++
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> using namespace std; /*BigInteger #include <boost/multiprecision/cpp_dec_float.hpp> #include <boost/multiprecision/cpp_int.hpp> #include <boost/rational.hpp> namespace xxx = boost::multiprecision; using Bint = xxx::cpp_int; using Real = xxx::number<xxx::cpp_dec_float<1024>>; */ #define int long long #define pb(x) push_back(x) #define m0(x) memset((x), 0LL, sizeof(x)) #define mm(x) memset((x), -1LL, sizeof(x)) //container #define ALL(x) (x).begin(), (x).end() #define RALL(a) (a).rbegin(), (a).rend() #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 UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end()); #define PERM(c) \ sort(ALL(c)); \ for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c))) // debug #define GET_VAR_NAME(variable) #variable #define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl; // bit_macro #define Bit(n) (1LL << (n)) #define Bitset(a, b) (a) |= (1LL << (b)) #define Bitunset(a, b) (a) &= ~(1LL << (b)) #define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL) #define Bitcount(a) __builtin_popcountll((a)) //typedef typedef long long lint; typedef unsigned long long ull; typedef complex<long double> Complex; typedef pair<int, int> P; typedef tuple<int, int, int> TP; typedef vector<int> vec; typedef vector<vec> mat; //constant constexpr int INF = (int)1e18; constexpr int MOD = (int)1e9 + 7; constexpr double PI = (double)acos(-1); constexpr double EPS = (double)1e-10; constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1}; constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1}; // template <typename T> void chmax(T &a, T b) { a = max(a, b); } template <typename T> void chmin(T &a, T b) { a = min(a, b); } // 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(); } // struct Accelerate_Cin { Accelerate_Cin() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(20); }; }; signed main() { int N, M; cin >> N >> M; vector<int> v(N, 1); v[0] *= -1; for (int i = 0; i < M; i++) { int x, y; cin >> x >> y; x--, y--; if (v[x] == 0) { continue; } else if (v[x] > 0) { v[x]--; if (v[y] < 0) {A v[y]--; } else { v[y]++; } } else if (v[x] < 0) { v[x]++; if (v[y] < 0) { v[y]--; } else { v[y]++; v[y] *= -1; } } } int ans = 0; for (int i = 0; i < N; i++) { if (v[i] < 0) ans++; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:100:22: error: 'A' was not declared in this scope 100 | if (v[y] < 0) {A | ^
s131169270
p04034
C++
#include <bits/stdc++.h> #define ALL(v) v.begin(), v.end() #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define rep1(i, n) for(int i = 1; i <= (int)(n); i++) using namespace std; typedef long long ll; int main() { int n; cin>>n; int m; cin>>m; int canf[n+1]=0; int val[n+1]=1; canf[1]=1; rep1(i, m){ int x,y; cin>>x>>y; val[x]--; val[y]++; if(canf[x]=1){ canf[y]=1;} if(val[x]=0){ canf[x]=0;} } int cnt=0; rep1(i, n){ cnt+=canf[i]; } cout<<cnt<<endl;
a.cc: In function 'int main()': a.cc:13:17: error: array must be initialized with a brace-enclosed initializer 13 | int canf[n+1]=0; | ^ a.cc:14:16: error: array must be initialized with a brace-enclosed initializer 14 | int val[n+1]=1; | ^ a.cc:32:19: error: expected '}' at end of input 32 | cout<<cnt<<endl; | ^ a.cc:8:12: note: to match this '{' 8 | int main() { | ^
s407047932
p04034
C++
#include <algorithm> #include <chrono> #include <climits> #include <cmath> #include <deque> #include <iostream> #include <map> #include <memory> #include <numeric> #include <set> #include <string> #include <utility> #include <vector> using namespace std; using llong = long long; using ullong = unsigned long long; #ifndef __MACRO_H__ #define __MACRO_H__ #define all(collection) (collection).begin(), (collection).end() #define loop(i, times) for (llong i = 0; i < times; i++) #define rloop(i, times) for (llong i = times -1; 0 <= i; i--) std::chrono::system_clock::time_point start; void TimeStart(void) { start = std::chrono::system_clock::now(); } void TimeEnd(void) { auto time = std::chrono::system_clock::now() - start; auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(time).count(); cerr << endl << msec << " msec " << endl; } #endif struct Box { bool red_; // 箱に赤が入っている可能性 llong count_; // 箱に入っているボールの数 }; struct Move { llong x_; llong y_; }; class AGC002B { public: AGC002B() { cin >> n_; cin >> m_; box_collection_.resize(n_); loop(i,n_) { box_collection_[i].red_ = false; box_collection_[i].count_ = 1; } box_collection_[0].red_ = true; move_collection_.resize(m_); loop(i,m_) { // 箱の添字とxやyの数字を一致させるため、入力時点でデクリメントしてしまう。 cin >> move_collection_[i].x_; cin >> move_collection_[i].y_; move_collection_[i].x_--; move_collection_[i].y_--; } ans_ = 0; } void Run(void) { for (const auto& elm_move : move_collection_) { if (0 < box_collection_[elm_move.x_].count_) { // xの箱にボールが1つ以上あるなら赤の可能性が1増える可能性がある box_collection_[elm_move.y_].count_++; box_collection_[elm_move.x_].count_--; if (box_collection_[elm_move.x_].red_) box_collection_[elm_move.y_].red_ = true; } // ボールが0になった箱には赤色ボールが存在しない if (box_collection_[elm_move.x_].count_ == 0) box_collection_[elm_move.x_].red_ = false; } // 結果出力 for (const auto& elm_box : box_collection_) { if (elm_box.red_) ans_++; } cout << ans_; } private: llong n_; llong m_; llong ans_; vector<Move> move_collection_; vector<Box> box_collection_; };
/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
s910003146
p04034
C++
#include <bits/stdc++.h> using namespace std; int main() { int N, M; cin >> N >> M; vector<int> A(M), B(M); for (int i = 0; i < M; i++) { cin >> A(i) >> B(i); } int c = 1, s = 0; for (int i = 0; i < M; i++) { if (A.at(i) == c){ c == B.at(i); s += 1; } } cout << s << endl; }
a.cc: In function 'int main()': a.cc:10:13: error: no match for call to '(std::vector<int>) (int&)' 10 | cin >> A(i) >> B(i); | ~^~~ a.cc:10:21: error: no match for call to '(std::vector<int>) (int&)' 10 | cin >> A(i) >> B(i); | ~^~~
s148974296
p04034
C++
#include<bits/stdc++.h> using namespace std; int n, m; int cnt[N], vis[N]; int main() { scanf("%d %d", &n, &m); for (int i = 1; i <= n; i++) { cnt[i] = 1; } vis[1] = 1; for (int i = 1; i <= m; i++) { int x, y; scanf("%d %d", &x, &y); if (vis[x]) { vis[y] = 1; } ++cnt[y]; if ((--cnt[x]) == 0) { vis[x] = 0; } } int cnt = 0; for (int i = 1; i <= n; i++) { if (vis[i]) ++cnt; } cout << cnt; return 0; }
a.cc:6:9: error: 'N' was not declared in this scope 6 | int cnt[N], vis[N]; | ^ a.cc:6:17: error: 'N' was not declared in this scope 6 | int cnt[N], vis[N]; | ^ a.cc: In function 'int main()': a.cc:11:5: error: 'cnt' was not declared in this scope; did you mean 'int'? 11 | cnt[i] = 1; | ^~~ | int a.cc:13:3: error: 'vis' was not declared in this scope 13 | vis[1] = 1; | ^~~ a.cc:20:7: error: 'cnt' was not declared in this scope; did you mean 'int'? 20 | ++cnt[y]; | ^~~ | int
s672582124
p04034
Java
import java.io.*; import java.util.StringTokenizer; public class BoxandBall { public static void main(String[] args) { try { FileReader in_file = new FileReader("b&b.in"); BufferedReader buff_in = new BufferedReader(in_file); FileWriter out_file = new FileWriter("b&b.out"); BufferedWriter buff_out = new BufferedWriter(out_file); PrintWriter output = new PrintWriter(buff_out); StringTokenizer st = new StringTokenizer(buff_in.readLine()); int boxes = Integer.parseInt(st.nextToken()); int operations = Integer.parseInt(st.nextToken()); int[] boxBalls = new int[boxes+1]; int possibility = 0; for(int i = 1; i < boxBalls.length; i++){ boxBalls[i] = 1; } for(int i = 0; i < operations; i++){ st = new StringTokenizer(buff_in.readLine()); int pick = Integer.parseInt(st.nextToken()); int put = Integer.parseInt(st.nextToken()); boxBalls[pick] = boxBalls[pick]-1; boxBalls[put] = boxBalls[put]+1; } for(int i = 0; i < boxBalls.length; i++){ if(boxBalls[i]!=0){ possibility++; } } output.println(possibility); buff_in.close(); output.close(); } catch (IOException e) { System.out.println(e); } } }
Main.java:4: error: class BoxandBall is public, should be declared in a file named BoxandBall.java public class BoxandBall { ^ 1 error
s276130292
p04034
C++
#include<iostream>#include<cstdio>#include<iostream>#include<cstring>using namespace std; bool a[100005];int b[100005]; int main(){ int n,m; while(cin>>n>>m) { int i; memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); for(i=1;i<=n;i++) b[i]=1; a[1]=1; while(m--) { int x1,x2; cin>>x1>>x2; if(a[x1]==1&&b[x1]==1) { a[x1]=0; a[x2]=1; } else if(a[x1]==1) a[x2]=1; b[x1]--; b[x2]++; } int sum=0; for(i=1;i<=n;i++) { if(a[i]&&b[i]>0) { sum++; } } cout<<sum<<endl; }}
a.cc:1:19: warning: extra tokens at end of #include directive 1 | #include<iostream>#include<cstdio>#include<iostream>#include<cstring>using namespace std; bool a[100005];int b[100005]; int main(){ int n,m; while(cin>>n>>m) { int i; memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); for(i=1;i<=n;i++) b[i]=1; a[1]=1; while(m--) { int x1,x2; cin>>x1>>x2; if(a[x1]==1&&b[x1]==1) { a[x1]=0; a[x2]=1; } else if(a[x1]==1) a[x2]=1; b[x1]--; b[x2]++; } int sum=0; for(i=1;i<=n;i++) { if(a[i]&&b[i]>0) { sum++; } } cout<<sum<<endl; }} | ^ /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s943676136
p04034
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; int N, M; int pos[100010], cnt[100010]; int main() { cin.tie(0); ios_base::sync_with_stdio(false); cout << fixed << setprecision(10); cin >> N >> M; pos[0] = 1; fill_n((int*)cnt, 100010, 1); for (int i = 0; i < M; i++) { int x, y; cin >> x >> y; x--; y--; cnt[x]--; cnt[y]++; if (pos[x]) { if (cnt[x] == 0) pos[x] = 0; pos[y] = 1; } } cout << accumulate(pos, pos + N, 0) << endl; return 0; } #include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; int N, M; int pos[100010], cnt[100010]; int main() { cin.tie(0); ios_base::sync_with_stdio(false); cout << fixed << setprecision(10); cin >> N >> M; pos[0] = 1; fill_n((int*)cnt, 100010, 1); for (int i = 0; i < M; i++) { int x, y; cin >> x >> y; x--; y--; cnt[x]--; cnt[y]++; if (pos[x]) { if (cnt[x] == 0) pos[x] = 0; pos[y] = 1; } } cout << accumulate(pos, pos + N, 0) << endl; return 0; }
a.cc:36:5: error: redefinition of 'int N' 36 | int N, M; | ^ a.cc:6:5: note: 'int N' previously declared here 6 | int N, M; | ^ a.cc:36:8: error: redefinition of 'int M' 36 | int N, M; | ^ a.cc:6:8: note: 'int M' previously declared here 6 | int N, M; | ^ a.cc:37:5: error: redefinition of 'int pos [100010]' 37 | int pos[100010], cnt[100010]; | ^~~ a.cc:7:5: note: 'int pos [100010]' previously declared here 7 | int pos[100010], cnt[100010]; | ^~~ a.cc:37:18: error: redefinition of 'int cnt [100010]' 37 | int pos[100010], cnt[100010]; | ^~~ a.cc:7:18: note: 'int cnt [100010]' previously declared here 7 | int pos[100010], cnt[100010]; | ^~~ a.cc:39:5: error: redefinition of 'int main()' 39 | int main() { | ^~~~ a.cc:9:5: note: 'int main()' previously defined here 9 | int main() { | ^~~~
s814321071
p04034
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) int main(){ int n,m; cin>>n>>m; int x[100010],y[100010]; bool b[100010]; rep(i,n){ b[i]=false; } b[1]=true; int c[100010]; rep(i,n){ c[i+1]=1; } rep(i,m){ cin>>x[i]>>y[i]; if(b[x[i]]){ b[y[i]]=true; } int s=x[i]; int t=y[i]; c[s]--; c[t]++; if(!c[x[i]])b[x[i]]=false; } rep(i,m){ int ans=0; rep(i,n){ if(b[i+1]==true)ans++; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:39:2: error: expected '}' at end of input 39 | } | ^ a.cc:7:11: note: to match this '{' 7 | int main(){ | ^
s552988236
p04034
C++
#include <bits/stdc++.h> using namespace std; int n,m; bool b[100005]; int tot[100005]; int ans=0; int main() { int x,y; cin>>n>>m; for(int i=1;i<=n;i++)tot[i]=1; b[1]=true; for(int i=1;i<=m;i++) { cin>>x>>y; if(tot[x]) { tot[x]--; tot[y]++; if(b[x])b[y]=true; } if(tot[x]==0) b[x]=false } for(int i=2;i<=n;i++) if(b[i]&&tot[i]) ans++; cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:23:23: error: expected ';' before '}' token 23 | b[x]=false | ^ | ; 24 | } | ~
s635313335
p04034
Java
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args)throws Exception { InputStreamReader is = new InputStreamReader(System.in); BufferedReader br = new BufferedReader (is); String input[] = br.readLine().split(" "); //[x][0] = ボールの個数 //[x][1] = 赤のボールがある //[x][2] = 赤のボールが入れられた int boxCount = Integer.parseInt(input[0]); int box[][] =new int [boxCount][3]; box[0][1] = 1; int order = Integer.parseInt(input[1]); while(br.ready()) { String temp[] = br.readLine().split(" "); int before = Integer.parseInt(temp[0]); int after = Integer.parseInt(temp[1]); if(box[before-1][0] >= 0) { box[before-1][0]--; box[after-1][0]++; if(box[before-1][1]==1) { box[before-1][1] = 0; box[after-1][1] = 1; box[after-1][2] = 1; } } } int result = 0; for(int i =0 ;i<boxCount ; i++) { if(box[i][0] >= 0) { if(box[i][2] == 1) { result++; } } } System.out.println(result); }
Main.java:41: error: reached end of file while parsing } ^ 1 error
s558557065
p04034
C++
#include<stdio.h> #include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <utility> #include <queue> #include <set> #include <sstream> #include <iomanip> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define ld long double #define rep(a,t) for(int a=0;a<t;++a) #define forever while(true) #define Sort(a) sort(a.begin(),a.end()) #define Reverse(a) reverse(a.begin(),a.end()) #define pb push_back #define int_maxvalue numeric_limits<int>::max() ll mod = 1e9 + 7; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m; cin >> n >> m; bool red[111111]; int white[111111];for(int i=1;i<=n;i++) if (i == 1) { red[i] = true; white[i] = 1; } else { red[i] = false; white[i] = 1; } }for(int i=1;i<=M;i++){ int from, to; cin >> from >> to; from--; to--; if (red[from]) { red[to] = true; } white[from]--; white[to]++; if(white[from]==0){red[to]=false;} } ll ans = 0; for(int i=1;i<=n;i++) { if (red[i]) { ans++; } } cout << ans << endl; return 0; }
a.cc:45:10: error: expected unqualified-id before 'for' 45 | }for(int i=1;i<=M;i++){ | ^~~ a.cc:45:22: error: 'i' does not name a type 45 | }for(int i=1;i<=M;i++){ | ^ a.cc:45:27: error: 'i' does not name a type 45 | }for(int i=1;i<=M;i++){ | ^ a.cc:57:9: error: expected unqualified-id before 'for' 57 | for(int i=1;i<=n;i++) { | ^~~ a.cc:57:21: error: 'i' does not name a type 57 | for(int i=1;i<=n;i++) { | ^ a.cc:57:26: error: 'i' does not name a type 57 | for(int i=1;i<=n;i++) { | ^ a.cc:62:1: error: 'cout' does not name a type 62 | cout << ans << endl; | ^~~~ a.cc:63:9: error: expected unqualified-id before 'return' 63 | return 0; | ^~~~~~ a.cc:64:1: error: expected declaration before '}' token 64 | } | ^
s501858155
p04034
C++
#include<stdio.h> #include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <utility> #include <queue> #include <set> #include <sstream> #include <iomanip> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define ld long double #define rep(a,t) for(int a=0;a<t;++a) #define forever while(true) #define Sort(a) sort(a.begin(),a.end()) #define Reverse(a) reverse(a.begin(),a.end()) #define pb push_back #define int_maxvalue numeric_limits<int>::max() ll mod = 1e9 + 7; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m; cin >> n >> m; bool red[111111]; int white[111111]; for(int i=1;i<=n;i++) if (i == 1) { red[i] = true; white[i] = 1; } else { red[i] = false; white[i] = 1; } } for(int i=1;i<=M;i++){ int from, to; cin >> from >> to; from--; to--; if (red[from]) { red[to] = true; } white[from]--; white[to]++; if(white[from]==0){red[to]=false;} } ll ans = 0; for(int i=1;i<=n;i++) { if (red[i]) { ans++; } } cout << ans << endl; return 0; }
a.cc:47:9: error: expected unqualified-id before 'for' 47 | for(int i=1;i<=M;i++){ | ^~~ a.cc:47:21: error: 'i' does not name a type 47 | for(int i=1;i<=M;i++){ | ^ a.cc:47:26: error: 'i' does not name a type 47 | for(int i=1;i<=M;i++){ | ^ a.cc:59:9: error: expected unqualified-id before 'for' 59 | for(int i=1;i<=n;i++) { | ^~~ a.cc:59:21: error: 'i' does not name a type 59 | for(int i=1;i<=n;i++) { | ^ a.cc:59:26: error: 'i' does not name a type 59 | for(int i=1;i<=n;i++) { | ^ a.cc:64:9: error: 'cout' does not name a type 64 | cout << ans << endl; | ^~~~ a.cc:65:9: error: expected unqualified-id before 'return' 65 | return 0; | ^~~~~~ a.cc:66:1: error: expected declaration before '}' token 66 | } | ^
s836867625
p04034
C++
#include <bits/stdc++.h> #define eps 1e-6 #define rep(i,n) for(int i=0;i<n;++i) #define rrep(i,n) for(int i=(n-1);i!=-1;i--) #define snc(a,b,c) ((a)?(b):(c)) #define YES cout<<"YES"<<endl #define NO cout<<"NO"<<endl #define Yes cout<<"Yes"<<endl; #define No cout<<"No"<<endl; #define ins insert #define pi acos(-1.0) #define pb push_back using namespace std; int main(){ int n,m; cin >> n >> m; bool ari[100001]={}; int ball[100001]; rep(i,n+1) ball[i]=1; ari[1] = true; for (int i=0;i<m;i++){ int a,b; cin >> a >> b; if (ball[a]>1) ari[b]+=ari[a]; else{ ari[b]+=ari[a]; ari[a]=false; } ari[b]++,ari[a]--; } int count=0; rep(i,n+1) if(ari[i]) count++; cout << count << endl; return 0; }
a.cc: In function 'int main()': a.cc:30:14: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17 30 | ari[b]++,ari[a]--; | ~~~~~^ a.cc:30:23: error: use of an operand of type 'bool' in 'operator--' is forbidden 30 | ari[b]++,ari[a]--; | ~~~~~^
s343927374
p04034
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef pair<ll,ll> pi; #define inf 1000000000000000000 #define rep(i,a,b) for (int i = a; i <= b; i++) #define f first #define s second #define pb push_back #define mp make_pair int ans=0, x, y, b[101010]; bool vis[202020]; vector<pi> v; int main(){ int n, m; rep(i, 1, 101010){ b[i]=1; } vis[1]=true; cin >> n >> m; rep(i, 1, m){ cin >> x >> y; v.pb({x,y}); } rep(i, 0, m-1){ if(v[i].f==1){ vis[v[i].s]=true; b[v[i].f]--; b[v[i].s]++; if(b[v[i].f]<=0)vis[b[i].f]=false; rep(j, i+1, m-1){ int x = v[j].f; int y = v[j].s; if(vis[x]){ vis[y]=true; } b[x]--; b[y]++; if(b[x]<=0)vis[x]=false; } break; } int x = v[i].f; int y = v[i].s; b[x]--; b[y]++; } rep(i, 1, n){ if(vis[i])ans++; } cout << ans << endl; return 0;}
a.cc: In function 'int main()': a.cc:9:11: error: request for member 'first' in 'b[i]', which is of non-class type 'int' 9 | #define f first | ^~~~~ a.cc:37:30: note: in expansion of macro 'f' 37 | if(b[v[i].f]<=0)vis[b[i].f]=false; | ^
s852539154
p04034
C++
// ------------------------------------ // Date:2018/ 2/24 // Problem:AGC 002 BoxAndBall b.cpp // // ------------------------------------ #include <bits/stdc++.h> using namespace std; #define EACH(i,a) for (auto&& i : a) #define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i) #define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) RFOR(i,0,n) #define ALL(a) (a).begin(),(a).end() using ll = long long; #define MOD 1000000007 // box int dp[100000]; bool ball[100000]; int main() { int N,M,x,y; cnt = 0; memset(dp,0,sizeof(dp)); memset(ball,false,sizeof(ball)); cin >> N >> M; FOR(i,1,N+2) { dp[i] = 1; } ball[1] = true; REP(i,M) { cin >> x >> y; if (ball[x]) { if (dp[x] == 1) { ball[x] = false; } ball[y] = true; } --dp[x]; ++dp[y]; } FOR(i,1,N+1) { //cout << i << "->" << (ball[i]?"Yes":"No") << endl; if (ball[i]) ++cnt; } cout << cnt << endl; return 0; }
a.cc: In function 'int main()': a.cc:29:3: error: 'cnt' was not declared in this scope; did you mean 'int'? 29 | cnt = 0; | ^~~ | int
s641639372
p04034
C++
#include<iostream> #include<algorithm> using namespace std; typedef long long int ll; int main(){ int N, M; bool memo[100000]; int num[100000]; cin >> N >> M; fill(memo, memo + N, false); fill(num, num + N, 1); memo[0] = true; for(int i = 1; i <= M; i++){ int x, y; cin >> x >> y; x--; y--; if(memo[x] == true) memo[y] = true; if(num[x] == 1) memo[x] = false; num[x]--; num[y]++; } int ans = 0; for(int i = 0; i < N; i++){ if(memo[i] == true) ans++; } cout << ans << endl; return 0;
a.cc: In function 'int main()': a.cc:26:18: error: expected '}' at end of input 26 | return 0; | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s103469341
p04034
C++
#include <biits/stdc++.h> using namespace std; const int N = 200010; int tag[N], n, x, y, m, ans, siz[N]; vector<int>v; int main() { scanf("%d%d", &n, &m); tag[1] = 1; for (int i = 1; i <= n; i++) siz[i] = 1; while (m--) { scanf("%d%d", &x, &y); if (tag[x]) tag[y] = 1; siz[x]--; siz[y]++; } for (int i = 1; i <= n; i++) ans += (tag[i] && siz[i]); cout << ans; }
a.cc:1:10: fatal error: biits/stdc++.h: No such file or directory 1 | #include <biits/stdc++.h> | ^~~~~~~~~~~~~~~~ compilation terminated.
s058131722
p04034
C++
n,m = [int(x) for x in input().split(' ')] prob = [1] + [0 for x in range(n-1)] ball = [1 for x in range(n)] for i in range(m): x,y = [int(x) for x in input().split(' ')] ball[x-1] -= 1 ball[y-1] += 1 if prob[x-1] == 1: prob[y-1] = 1 if ball[x-1] == 0: prob[x-1] = 0 print(sum(prob))
a.cc:1:1: error: 'n' does not name a type 1 | n,m = [int(x) for x in input().split(' ')] | ^
s142912994
p04034
C
4 4 1 2 2 3 4 1 3 4
main.c:1:1: error: expected identifier or '(' before numeric constant 1 | 4 4 | ^
s852528556
p04034
C++
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <vector> using namespace std; template<class T> void gc(T &x) { int s, k, m = 0; x = 0; k = getchar_unlocked(); if (k == '-') s = 1; k = getchar_unlocked(); while (true) { k = getchar_unlocked(); if (k < '0' || k > '9') break; x = x * 10 + k - '0'; } if (m) x = -x; return x; } int main() { int N, M; gc(N); gc(M); vector<int> num; vector<bool> red; for (int i = 0; i < N; i++) { num.push_back(1); red.push_back(false); } red[0] = true; for (int i = 0; i < M; i++) { int x, y; gc(x); gc(y); if (red[x - 1]) red[y - 1] = true; num[x - 1]--; num[y - 1]++; if (!num[x - 1]) red[x - 1] = false; } int ans = 0; for (int i = 0; i < N; i++) { if (red[i]) ans++; } printf("%d\n", ans); return 0; }
a.cc: In instantiation of 'void gc(T&) [with T = int]': a.cc:33:7: required from here 33 | gc(N); | ~~^~~ a.cc:26:12: error: return-statement with a value, in function returning 'void' [-fpermissive] 26 | return x; | ^
s487934468
p04034
C++
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <vector> using namespace std; template<class T> void gc(T &x) { int s, k, m = 0; T x = 0; k = getchar_unlocked(); if (k == '-') s = 1; k = getchar_unlocked(); while (true) { k = getchar_unlocked(); if (k < '0' || k > '9') break; x = x * 10 + k - '0'; } if (m) x = -x; return x; } int main() { int N, M; gc(N); gc(M); vector<int> num; vector<bool> red; for (int i = 0; i < N; i++) { num.push_back(1); red.push_back(false); } red[0] = true; for (int i = 0; i < M; i++) { int x, y; gc(x); gc(y); if (red[x - 1]) red[y - 1] = true; num[x - 1]--; num[y - 1]++; if (!num[x - 1]) red[x - 1] = false; } int ans = 0; for (int i = 0; i < N; i++) { if (red[i]) ans++; } printf("%d\n", ans); return 0; }
a.cc: In function 'void gc(T&)': a.cc:9:7: error: declaration of 'T x' shadows a parameter 9 | T x = 0; | ^ a.cc:6:30: note: 'T& x' previously declared here 6 | template<class T> void gc(T &x) | ~~~^ a.cc: In instantiation of 'void gc(T&) [with T = int]': a.cc:33:7: required from here 33 | gc(N); | ~~^~~ a.cc:26:12: error: return-statement with a value, in function returning 'void' [-fpermissive] 26 | return x; | ^
s427683114
p04034
C++
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <vector> using namespace std; template<class T> T gc() { int s, k, m = 0; T x = 0; k = getchar_unlocked(); if (k == '-') s = 1; k = getchar_unlocked(); while (true) { k = getchar_unlocked(); if (k < '0' || k > '9') break; x = x * 10 + k - '0'; } if (m) x = -x; return x; } int main() { int N, M; gc(N); gc(M); vector<int> num; vector<bool> red; for (int i = 0; i < N; i++) { num.push_back(1); red.push_back(false); } red[0] = true; for (int i = 0; i < M; i++) { int x, y; gc(x); gc(y); if (red[x - 1]) red[y - 1] = true; num[x - 1]--; num[y - 1]++; if (!num[x - 1]) red[x - 1] = false; } int ans = 0; for (int i = 0; i < N; i++) { if (red[i]) ans++; } printf("%d\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:33:7: error: no matching function for call to 'gc(int&)' 33 | gc(N); | ~~^~~ a.cc:6:21: note: candidate: 'template<class T> T gc()' 6 | template<class T> T gc() | ^~ a.cc:6:21: note: candidate expects 0 arguments, 1 provided a.cc:34:7: error: no matching function for call to 'gc(int&)' 34 | gc(M); | ~~^~~ a.cc:6:21: note: candidate: 'template<class T> T gc()' 6 | template<class T> T gc() | ^~ a.cc:6:21: note: candidate expects 0 arguments, 1 provided a.cc:51:11: error: no matching function for call to 'gc(int&)' 51 | gc(x); | ~~^~~ a.cc:6:21: note: candidate: 'template<class T> T gc()' 6 | template<class T> T gc() | ^~ a.cc:6:21: note: candidate expects 0 arguments, 1 provided a.cc:52:11: error: no matching function for call to 'gc(int&)' 52 | gc(y); | ~~^~~ a.cc:6:21: note: candidate: 'template<class T> T gc()' 6 | template<class T> T gc() | ^~ a.cc:6:21: note: candidate expects 0 arguments, 1 provided
s250944577
p04034
C++
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <vector> using namespace std; template<class T> inline T gc() { int s, k, m = 0; T x = 0; k = getchar_unlocked(); if (k == '-') s = 1; k = getchar_unlocked(); while (true) { k = getchar_unlocked(); if (k < '0' || k > '9') break; x = x * 10 + k - '0'; } if (m) x = -x; return x; } int main() { int N = gc(); int M = gc(); vector<int> num; vector<bool> red; for (int i = 0; i < N; i++) { num.push_back(1); red.push_back(false); } red[0] = true; for (int i = 0; i < M; i++) { int x = gc(); int y = gc(); if (red[x - 1]) red[y - 1] = true; num[x - 1]--; num[y - 1]++; if (!num[x - 1]) red[x - 1] = false; } int ans = 0; for (int i = 0; i < N; i++) { if (red[i]) ans++; } printf("%d\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:32:15: error: no matching function for call to 'gc()' 32 | int N = gc(); | ~~^~ a.cc:7:10: note: candidate: 'template<class T> T gc()' 7 | inline T gc() | ^~ a.cc:7:10: note: template argument deduction/substitution failed: a.cc:32:15: note: couldn't deduce template parameter 'T' 32 | int N = gc(); | ~~^~ a.cc:33:15: error: no matching function for call to 'gc()' 33 | int M = gc(); | ~~^~ a.cc:7:10: note: candidate: 'template<class T> T gc()' 7 | inline T gc() | ^~ a.cc:7:10: note: template argument deduction/substitution failed: a.cc:33:15: note: couldn't deduce template parameter 'T' 33 | int M = gc(); | ~~^~ a.cc:48:19: error: no matching function for call to 'gc()' 48 | int x = gc(); | ~~^~ a.cc:7:10: note: candidate: 'template<class T> T gc()' 7 | inline T gc() | ^~ a.cc:7:10: note: template argument deduction/substitution failed: a.cc:48:19: note: couldn't deduce template parameter 'T' 48 | int x = gc(); | ~~^~ a.cc:49:19: error: no matching function for call to 'gc()' 49 | int y = gc(); | ~~^~ a.cc:7:10: note: candidate: 'template<class T> T gc()' 7 | inline T gc() | ^~ a.cc:7:10: note: template argument deduction/substitution failed: a.cc:49:19: note: couldn't deduce template parameter 'T' 49 | int y = gc(); | ~~^~
s235892886
p04034
C
#include <stdio.h> int N, M; int x[100010]; int y[100010]; int box[100010]; bool exist[100010]; int main() { scanf("%d %d",&N,&M); int i; for (i = 0; i < M; i++) { scanf("%d %d",&x[i],&y[i]); } for (i = 1; i <= N; i++) { box[i] = 1; exist[i] = false; } exist[1] = true; for (i = 0; i < M; i++) { if (exist[x[i]]) { exist[y[i]] = true; } if (box[x[i]] == 1 && exist[x[i]]) { exist[x[i]] = false; } box[x[i]]--; box[y[i]]++; } int ans = 0; for (i = 1; i <= N; i++) { if (exist[i]) { ans++; } } printf("%d\n",ans); return 0; }
main.c:9:1: error: unknown type name 'bool' 9 | bool exist[100010]; | ^~~~ main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 1 | #include <stdio.h> +++ |+#include <stdbool.h> 2 | main.c: In function 'main': main.c:23:28: error: 'false' undeclared (first use in this function) 23 | exist[i] = false; | ^~~~~ main.c:23:28: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' main.c:23:28: note: each undeclared identifier is reported only once for each function it appears in main.c:25:20: error: 'true' undeclared (first use in this function) 25 | exist[1] = true; | ^~~~ main.c:25:20: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
s615266428
p04034
C
#include <stdio.h> //デバッグ void debug(int matrix[], int max) { int i; for(i=0; i<max; i++) printf("%d ", matrix[i]); printf("\n"); } //boxセット void set_box(int matrix[], int max) { int i; matrix[0] = 1; for(i=1; i<max; i++) matrix[i] = 0; } void set_clone(int clone[], int N) { int i; for(i=0; i<N; i++){ clone[i] = 1; } } int main(void) { int N,M; //入力 int box_cnt=0, cnt = 0; int x,y; //入力情報 int box[100]={0}; //箱配列 int clone[100]={0}; int i; //N,Mの入力 scanf("%d %d", &N, &M); set_box(box, N); //セット set_clone(clone, N); //debug(box, N); //デバッグ //入力と箱の移動 for(i=1; i<=M; i++){ scanf("%d %d", &x, &y); //入力 if(x == y){ i-- continue; } //添え字 x -= 1; y -= 1; if(clone[x] == 0){ i--; continue; } //初期処理 if(x==0 && cnt==0){ //赤ボールの初期位置 box[y] = box[x]; box[x] = 0; clone[x]--; //個数を減らす clone[y]++; cnt++; } else if(box[x]==1 && box[y]==0){ //1 -> 0 に移動 box[y] = 1; //個数 clone[y]++; clone[x]--; } else if(box[x]==0 && box[y]==1){ //1 -> 0 に移動 //個数 clone[y]++; clone[x]--; } else if(box[x]==0 && box[y]==1){ //1 -> 0 に移動 //個数 clone[y]++; clone[x]--; } else if(box[x]==1 && box[y]==1){ //1 -> 1 に移動 //個数 clone[y]++; clone[x]--; } } //出力準備 for(i=0; i<N; i++){ if(box[i] == 1 && clone[i] > 0) box_cnt++; } printf("%d\n", box_cnt); return 0; }
main.c: In function 'main': main.c:55:28: error: expected ';' before 'continue' 55 | i-- | ^ | ; 56 | continue; | ~~~~~~~~
s625928738
p04034
C++
#include<iostream> #include<string.h> #include<string> #include<cstdio> using namespace std; bool p[100010]; int num[100010]; int main() { int N, M, x, y, ans = 0; cin >> N >> M; for (int i = 0; i <= N; i++) { p[i] = false; num[i] = 1; } p[0] = true; for (int i = 0; i < M; i++) { scanf_s("%d %d", &x, &y); if (p[x-1] == true)p[y-1] = true; num[x - 1]--; num[y - 1]++; if (num[x - 1] == 0)p[x - 1] = false; } for (int i = 0; i < N; i++) { if (p[i] == true && num[i] != 0)ans++; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:17:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 17 | scanf_s("%d %d", &x, &y); | ^~~~~~~ | scanf
s880417712
p04034
C++
int main(){ int N, M; cin >> N >> M; pair<int,bool> boxs[100000] = {}; for(int i = 0; i < N; i++){ boxs[i].first = 1; if(i == 0) boxs[i].second = true; else boxs[i].second = false; } for(int i = 0; i < M; i++){ int a,b; cin >> a >> b; a--; b--; if(boxs[a].second){ boxs[b].second = true; } boxs[a].first -= 1; boxs[b].first += 1; if(boxs[a].first == 0) boxs[a].second = false; } int cnt = 0; for(int i = 0; i < N; i++){ if(boxs[i].second) cnt++; } cout << cnt << endl; }
a.cc: In function 'int main()': a.cc:3:5: error: 'cin' was not declared in this scope 3 | cin >> N >> M; | ^~~ a.cc:4:5: error: 'pair' was not declared in this scope 4 | pair<int,bool> boxs[100000] = {}; | ^~~~ a.cc:4:10: error: expected primary-expression before 'int' 4 | pair<int,bool> boxs[100000] = {}; | ^~~ a.cc:7:9: error: 'boxs' was not declared in this scope 7 | boxs[i].first = 1; | ^~~~ a.cc:17:12: error: 'boxs' was not declared in this scope 17 | if(boxs[a].second){ | ^~~~ a.cc:21:9: error: 'boxs' was not declared in this scope 21 | boxs[a].first -= 1; | ^~~~ a.cc:29:12: error: 'boxs' was not declared in this scope 29 | if(boxs[i].second) cnt++; | ^~~~ a.cc:32:5: error: 'cout' was not declared in this scope 32 | cout << cnt << endl; | ^~~~ a.cc:32:20: error: 'endl' was not declared in this scope 32 | cout << cnt << endl; | ^~~~
s911328657
p04034
C++
#include<iostream> #include<vector> #define eps 1e-18 using namespace std; int main(){ int n, m, x, y, ans = 0; std::cin >> n >> m; vector<int> ball(n, 1); vector<long double> box(n, 0); box[0] = 1; for (int i = 0; i < m; i++) { std::cin >> x >> y; x--, y--; box[y] += box[x]/ball[x]; box[x] -= box[x]/ball[x]; ball[x]--, ball[y]++; // std::cout << "box:" << std::endl; // for (int i = 0; i < n; i++) { // std::cout << box[i] << std::endl; // } // std::cout << "ball:" << std::endl; // for (int i = 0; i < n; i++) { // std::cout << ball[i] << std::endl; // } // std::cout << std::endl; // } for (int i = 0; i < n; i++) { if(box[i] > eps)ans++; } std::cout << ans << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:33:2: error: expected '}' at end of input 33 | } | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^
s036400171
p04034
C++
int main(void) { cin.tie(0); ios::sync_with_stdio(false); int N, M; cin >> N >> M; vector<int> boxes(N), flags(N); for (int i = 0; i < N; i++) boxes[i] = 1; for (int i = 0; i < N; i++) flags[i] = 0; flags[0] = 1; for (int i = 0; i < M; i++) { int x, y; cin >> x >> y; x--; y--; if (flags[x]) { if (boxes[x] == 1) { flags[x] = 0; flags[y] = 1; boxes[x]--; boxes[y]++; } else { flags[y] = 1; boxes[x]--; boxes[y]++; } } else { boxes[x]--; boxes[y]++; } } int ans = 0; for (int i = 0; i < N; i++) { ans += flags[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:2:5: error: 'cin' was not declared in this scope 2 | cin.tie(0); | ^~~ a.cc:3:5: error: 'ios' has not been declared 3 | ios::sync_with_stdio(false); | ^~~ a.cc:6:5: error: 'vector' was not declared in this scope 6 | vector<int> boxes(N), flags(N); | ^~~~~~ a.cc:6:12: error: expected primary-expression before 'int' 6 | vector<int> boxes(N), flags(N); | ^~~ a.cc:7:33: error: 'boxes' was not declared in this scope 7 | for (int i = 0; i < N; i++) boxes[i] = 1; | ^~~~~ a.cc:8:33: error: 'flags' was not declared in this scope 8 | for (int i = 0; i < N; i++) flags[i] = 0; | ^~~~~ a.cc:9:5: error: 'flags' was not declared in this scope 9 | flags[0] = 1; | ^~~~~ a.cc:15:17: error: 'boxes' was not declared in this scope 15 | if (boxes[x] == 1) { | ^~~~~ a.cc:26:13: error: 'boxes' was not declared in this scope 26 | boxes[x]--; | ^~~~~ a.cc:36:5: error: 'cout' was not declared in this scope 36 | cout << ans << endl; | ^~~~ a.cc:36:20: error: 'endl' was not declared in this scope 36 | cout << ans << endl; | ^~~~
s206582323
p04034
C++
#include <bits/stdc++.h> using namespace std; typedef long long lint; typedef pair<int, int> pi; int n, m; int ok[100005]; \ int main(){ cin >> n >> m; ok[1] = 1; while(m--){ int s, e; scanf("%d %d",&s,&e); if(ok[s]) ok[e] = 1; disj.uni(s, e); } cout << count(ok, ok + n + 1, 1) << endl; }
a.cc: In function 'int main()': a.cc:16:17: error: 'disj' was not declared in this scope 16 | disj.uni(s, e); | ^~~~
s835979855
p04035
C++
5 50 10 20 30 40 50
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 5 50 | ^
s595116809
p04035
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(ll i=0;i<n;i++) #define repl(i,l,r) for(ll i=(l);i<(r);i++) #define per(i,n) for(ll i=n-1;i>=0;i--) #define perl(i,r,l) for(ll i=r-1;i>=l;i--) #define fi first #define se second #define pb push_back #define ins insert #define all(x) (x).begin(),(x).end() using ll=long long; using vl=vector<ll>; using vvl=vector<vector<ll>>; const ll MOD=1000000007; const ll MOD9=998244353; const int inf=1e9+10; const ll INF=4e18; const ll dy[8]={1,0,-1,0,1,1,-1,-1}; const ll dx[8]={0,-1,0,1,1,-1,1,-1}; using Graph = vector<vector<int>>; double nCk(int n, int k) { double res=1.0; for(int i=0; i<n; i++){ res*=0.5;} for(int i=0; i<k; i++){ res*=(double)(n-i); res/=(double)(k-i); } return res;} struct edge{ll to, cost;}; typedef pair<ll,ll> P; struct graph{ ll V; vector<vector<edge> > G; vector<ll> d; graph(ll n){ init(n); } void init(ll n){ V = n; G.resize(V); d.resize(V); rep(i,V){ d[i] = INF; } } void add_edge(ll s, ll t, ll cost){ edge e; e.to = t, e.cost = cost; G[s].push_back(e); } void dijkstra(ll s){ rep(i,V){ d[i] = INF; } d[s] = 0; priority_queue<P,vector<P>, greater<P> > que; que.push(P(0,s)); while(!que.empty()){ P p = que.top(); que.pop(); ll v = p.second; if(d[v]<p.first) continue; for(auto e : G[v]){ if(d[e.to]>d[v]+e.cost){ d[e.to] = d[v]+e.cost; que.push(P(d[e.to],e.to)); } } } } }; int main(){ ll n,l; cin>>n>>l; ll a[n]={}; rep(i,n) cin>>a[i]; ll b[n-1]={}; ll k = 0; rep(i,n-1){ b[i]=a[i]+a[i+1]; k = max(b[i],k);} ll r = 0; rep(i,n-1){ if(b[i]==k){ r = i+1; break;} } if(k>=l) cout << "Possible" << endl; rep(i,n-1){ if(i!=r) cout << i << endl; } cout << r << endl;} else{ cout << "Impossible" << endl;}}
a.cc:97:1: error: expected unqualified-id before 'else' 97 | else{ | ^~~~ a.cc:98:31: error: expected declaration before '}' token 98 | cout << "Impossible" << endl;}} | ^
s318822539
p04035
C++
#include<bits/stdc++.h> using namespace std; using ull=unsigned long long; #define mod 1000000007 #define mod2 998244353 #define PI 3.14159265 #define ll long long #define ld long double #define pi pair<ll,ll> #define pb push_back #define vi vector<ll> #define sz size() #define setbits(x) __builtin_popcount(x) #define fi first #define se second #define lz length() #define all(x) (x).begin(),(x).end() #define scf(x) scanf("%lld",&x) #define rep(i,n) for(ll i=0;i<n;i++) const int INF = (int)1e9; const ll IINF=1LL<<62; const int maxn=10000005; //int divr[maxn]; /**/ /*void divisor() {for(int i=2;i<sqrt(maxn);i++) { if(!divr[i]) { for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i; } } for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i; }*/ /*const int N=1000005; ll n; struct line { long long m, c; long long eval(long long x) { return m * x + c; } long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); } }; vector<pair<pi,ll>> rect; deque<line> dq; */ /*int find(int a){ if(a==par[a])return a; return par[a]=find(par[a]); } void unite(int a,int b){ a=find(a),b=find(b); if(a==b)return ; par[b]=a; } ll modexpo(ll a,ll b) { int ans=1LL; while(b>0) { if(b&1)ans=(ans*a)%mod; a=(a*a)%mod; b>>=1; } return ans; } */ int main(){ ll n,l; cin>>n>>l; vector<ll> a(n); vector<pi> vec; for(int i=0;i<n;i++){ cin>>a[i];vec.pb({a[i],i+1}); } vector<int> ans; sort(vec.begin(),vec.end()); int idx=0; ll tmp=0; for(int i=0;i<n;i++){ tmp+=vec[i].fi; if(tmp>=l&&i>=1){ ans.pb(vec[idx].se); tmp-=vec[idx].fi;idx++; } } if(tmp>=l&&ans.size()<n-1){ ans.pb(vec[idx].se); } if(ans.size()==n-1){ cout<<"Possible\n"; for(auto it:ans)cout<<it<<endl; } else{ cout<<"Impossible"; } } #include<bits/stdc++.h> using namespace std; using ull=unsigned long long; #define mod 1000000007 #define mod2 998244353 #define PI 3.14159265 #define ll long long #define ld long double #define pi pair<ll,ll> #define pb push_back #define vi vector<ll> #define sz size() #define setbits(x) __builtin_popcount(x) #define fi first #define se second #define lz length() #define all(x) (x).begin(),(x).end() #define scf(x) scanf("%lld",&x) #define rep(i,n) for(ll i=0;i<n;i++) const int INF = (int)1e9; const ll IINF=1LL<<62; const int maxn=10000005; //int divr[maxn]; /**/ /*void divisor() {for(int i=2;i<sqrt(maxn);i++) { if(!divr[i]) { for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i; } } for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i; }*/ /*const int N=1000005; ll n; struct line { long long m, c; long long eval(long long x) { return m * x + c; } long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); } }; vector<pair<pi,ll>> rect; deque<line> dq; */ /*int find(int a){ if(a==par[a])return a; return par[a]=find(par[a]); } void unite(int a,int b){ a=find(a),b=find(b); if(a==b)return ; par[b]=a; } ll modexpo(ll a,ll b) { int ans=1LL; while(b>0) { if(b&1)ans=(ans*a)%mod; a=(a*a)%mod; b>>=1; } return ans; } */ int main(){ ll n,l; cin>>n>>l; vector<ll> a(n); vector<pi> vec; for(int i=0;i<n;i++){ cin>>a[i];vec.pb({a[i],i}); } vector<int> ans; sort(vec.begin(),vec.end()); if(vec[n-1].fi+vec[n-2].fi>=l){ cout<<"Possible\n"; for(int i=0;i<n-1;i++){ cout<<vec[i].se<<"\n"; } } else{ cout<<"Impossible"; } }
a.cc:158:11: error: redefinition of 'const int INF' 158 | const int INF = (int)1e9; | ^~~ a.cc:20:11: note: 'const int INF' previously defined here 20 | const int INF = (int)1e9; | ^~~ a.cc:159:10: error: redefinition of 'const long long int IINF' 159 | const ll IINF=1LL<<62; | ^~~~ a.cc:21:10: note: 'const long long int IINF' previously defined here 21 | const ll IINF=1LL<<62; | ^~~~ a.cc:160:11: error: redefinition of 'const int maxn' 160 | const int maxn=10000005; | ^~~~ a.cc:22:11: note: 'const int maxn' previously defined here 22 | const int maxn=10000005; | ^~~~ a.cc:211:5: error: redefinition of 'int main()' 211 | int main(){ | ^~~~ a.cc:73:5: note: 'int main()' previously defined here 73 | int main(){ | ^~~~
s384293153
p04035
C++
#include <bits/stdc++.h> #include "/home/itohdak/AtCoder/000/print.hpp" using namespace std; #define ll long long #define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--) #define rrep(i,n) RREP(i,n-1,0) #define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++) #define repl(i,n) REPL(i,0,n) #define all(v) v.begin(), v.end() const int inf = 1e9+7; const ll longinf = 1LL<<60; const ll mod = 1e9+7; int main() { int N; ll L; cin >> N >> L; vector<ll> A(N), sum(N+1); rep(i, N) { cin >> A[i]; sum[i+1] = sum[i] + A[i]; } int l=0, r=N; vector<int> ans; bool ok = true; while(l+1<r) { if(sum[r]-sum[l]<L) { ok = false; break; } ll l1 = sum[r]-sum[l+1]; ll l2 = sum[r-1]-sum[l]; if(r-l==2) { ans.push_back(l+1); l++; } else { if(l1<L && l2<L) { ok = false; break; } if(l1 > l2) { ans.push_back(l+1); l++; } else { ans.push_back(r-1); r--; } } } if(ok) { cout << "Possible" << endl; for(int i: ans) cout << i << endl; } else { cout << "Impossible" << endl; } return 0; }
a.cc:2:10: fatal error: /home/itohdak/AtCoder/000/print.hpp: No such file or directory 2 | #include "/home/itohdak/AtCoder/000/print.hpp" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s064621404
p04035
C++
#include <iostream> //#include <bits/stdc++.h> // a&1 check odd or not and a>>=1 halfs a #include <cstdlib> #include <cstdio> #include <vector> #include <queue> #include <algorithm> #define loop(i,a,b) for(int i=a;i<b;i++) #define pb(x) push_back(x) #define F first #define S second using namespace std; #define ll long long const int N=1e5+8; int n; ll arr[N]; ll joints[N]; ll l; void solve(){ cin>>n>>l; loop(i,0,n){ cin>>arr[i]; } ll maxlen=-1*INT_MAX; ll ind; loop(i,0,n-1){ joints[i]=arr[i]+arr[i+1]; if(maxlen<joints[i]){ ind=i; maxlen=joints[i]; } } if(maxlen<l){ puts("Impossible"); } else{ puts("Possible"); if(ind==0){ for(int i=n-2;i>=0;i--){ cout<<i+1<<endl; } } else if(ind==n-2){ for(int i=0;i<n-1;i++){ cout<<i+1<<endl; } } else{ for(int i=n-2;i>ind;i--){ cout<<i+1<<endl; } for(int i=0;i<ind;i++){ cout<<i+1<<endl; } cout<<ind+1<<endl; } } } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); solve(); return 0; }
a.cc: In function 'void solve()': a.cc:26:22: error: 'INT_MAX' was not declared in this scope 26 | ll maxlen=-1*INT_MAX; | ^~~~~~~ a.cc:9:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 8 | #include <algorithm> +++ |+#include <climits> 9 | #define loop(i,a,b) for(int i=a;i<b;i++)
s998370222
p04035
C++
#include<iostream> #include<algorithm> using namespace std; typedef long long ll; ll n, L; ll a[100000]; int main() { cin >> n >> L; for(int i = 0; i < n; i++){ cin >> a[i]; } if(a[0] + a[1] >= L){ cout << "Possible" << endl; for(int i = n - 1; i >= 1; i--)cout << i << endl; return 0; } if(a[n - 1] + a[n - 2] >= L){ cout << "Possible" << endl; for(int i = 1; i < n; i++)cout << i << endl; return 0; } vector<pair<int, int>> ans; int bef = 0; for(int i = 0; i < n - 2; i++){ if(a[i] >= L){ if(i != bef){ bef = i + 1; }else { cout << "Possible" << endl; for(int j = 1; j <= i; j++)cout << j << endl; for(int j = n - 1; j > i; j--)cout << j << endl; return 0; } } if(a[i] + a[i + 1] >= L){ if(bef != i){ bef = i + 2; i++; }else { cout << "Possible" << endl; for(int j = 1; j <= i; j++)cout << j << endl; for(int j = n - 1; j > i; j--)cout << j << endl; return 0; } } } cout << "Impossible" << endl; return 0; }
a.cc: In function 'int main()': a.cc:28:9: error: 'vector' was not declared in this scope 28 | vector<pair<int, int>> ans; | ^~~~~~ a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 2 | #include<algorithm> +++ |+#include <vector> 3 | a.cc:28:29: error: expected primary-expression before '>' token 28 | vector<pair<int, int>> ans; | ^~ a.cc:28:32: error: 'ans' was not declared in this scope; did you mean 'abs'? 28 | vector<pair<int, int>> ans; | ^~~ | abs
s278526882
p04035
C++
#include<iostream> #include<algorithm> using namespace std; typedef long long ll; ll n, L; ll a[100000]; int main() { cin >> n >> L; for(int i = 0; i < n; i++){ cin >> a[i]; } if(a[0] + a[1] >= L){ cout << "Possible" << endl; for(int i = n - 1; i >= 1; i--)cout << i << endl; return 0; } if(a[n - 1] + a[n - 2] >= L){ cout << "Possible" << endl; for(int i = 1; i < n; i++)cout << i << endl; cout << endl; return 0; } vector<pair<int, int>> ans; int bef = 0; for(int i = 0; i < n - 2; i++){ if(a[i] >= L){ if(i != bef){ bef = i + 1; }else { cout << "Possible" << endl; for(int j = 1; j <= i; j++)cout << j << endl; for(int j = n - 1; j > i; j--)cout << j << endl; return 0; } } if(a[i] + a[i + 1] >= L){ if(bef != i){ bef = i + 2; i++; }else { cout << "Possible" << endl; for(int j = 1; j <= i; j++)cout << j << endl; for(int j = n - 1; j > i; j--)cout << j << endl; cout<<endl; return 0; } } } cout << "Impossible" << endl; return 0; }
a.cc: In function 'int main()': a.cc:29:9: error: 'vector' was not declared in this scope 29 | vector<pair<int, int>> ans; | ^~~~~~ a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 2 | #include<algorithm> +++ |+#include <vector> 3 | a.cc:29:29: error: expected primary-expression before '>' token 29 | vector<pair<int, int>> ans; | ^~ a.cc:29:32: error: 'ans' was not declared in this scope; did you mean 'abs'? 29 | vector<pair<int, int>> ans; | ^~~ | abs
s488516605
p04035
C++
/#include<iostream> #include<algorithm> using namespace std; typedef long long ll; ll n, L; ll a[100000]; int main() { cin >> n >> L; for(int i = 0; i < n; i++){ cin >> a[i]; } if(a[0] + a[1] >= L){ cout << "Possible" << endl; for(int i = n - 1; i >= 1; i--)cout << i << endl; return 0; } if(a[n - 1] + a[n - 2] >= L){ cout << "Possible" << endl; for(int i = 1; i < n; i++)cout << i << endl; cout << endl; return 0; } cout << "Impossible" << endl; return 0; }
a.cc:1:2: error: stray '#' in program 1 | /#include<iostream> | ^ a.cc:1:1: error: expected unqualified-id before '/' token 1 | /#include<iostream> | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 i
s570670761
p04035
C++
#include <bits/stdc++.h> #define rep(X,N) for(ll X = 0; X < (N); X++) #define PI (acos(-1.0)) #define pback push_back #define mpair make_pair #define MODN 1000000007 #define ALL(V) (V).begin(),(V).end() #define INT_MAX_HALF (INT_MAX / 2) #define EPS (1e-10) using namespace std; typedef long long ll; int main(){ int n; ll l; cin >> n >> l; vector<ll> a(n); rep(i, n){ cin >> a[i]; } bool able = false; int last; rep(i, n - 1){ if(a[i] + a[i + 1] >= l){ able = true; last = i + 1; break; } } if(able){ cout << "Possible" << endl; for(int i = 1; i < n; i++){ if(i == last) coninue; cout << i << endl; } cout << last << endl; }else{ cout << "Impossible" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:43:27: error: 'coninue' was not declared in this scope 43 | if(i == last) coninue; | ^~~~~~~
s292406708
p04035
C++
#include <bits/stdc++.h> using namespace std; #define N 100001 int n, m; int main() { scanf("%d%d", &n, &m); int add = 0; for (int i = 1; i <= n; i++) scanf("%d", &a[i]); for (int i = 1; i < n; i++) if (a[i] + a[i + 1] >= m) add = i; if (add) { puts("Possible"); for (int i = 1; i < add; i++) printf("%d\n", i); for (int i = n - 1; i > add; i--) printf("%d\n", i); printf("%d\n", add); } else puts("Impossible"); return 0; }
a.cc: In function 'int main()': a.cc:8:47: error: 'a' was not declared in this scope 8 | for (int i = 1; i <= n; i++) scanf("%d", &a[i]); | ^ a.cc:10:13: error: 'a' was not declared in this scope 10 | if (a[i] + a[i + 1] >= m) add = i; | ^
s070330141
p04035
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define fi first #define se second #define sz size() #define bgn begin() #define en end() #define pb push_back #define pp() pop_back() #define V vector #define P pair #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(),a.end()),a.end()) #define Q queue #define pri priority_queue #define Pri priority_queue<int,vector<int>,greater<int>> #define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>> #define ff first.first #define fs first.second #define sf second.first #define ss second.second #define all(a) (a).begin(),(a).end() #define elif else if int low(V<int> a,int b){ decltype(a)::iterator c=lower_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } int upp(V<int> a,int b){ decltype(a)::iterator c=upper_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } template<class T> void cou(vector<vector<T>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } } int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } int gcm(int a,int b){ if(a%b==0) return b; return gcm(b,a%b); } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; for(int i=3;i<=sqrt(a)+1;i+=2){ if (a%i==0) return false; } return true; } struct Union{ vector<int> par; Union(int a){ par=vector<int>(a,-1); } int find(int a){ if(par[a]<0) return a; else return par[a]=find(par[a]); } bool same(int a,int b){ return find(a)==find(b); } int Size(int a){ return -par[find(a)]; } void unite(int a,int b){ a=find(a); b=find(b); if(a==b) return; if(Size(b)>Size(a)) swap<int>(a,b); par[a]+=par[b]; par[b]=a; } }; int ketas(int a){ string b=to_string(a); int c=0; fo(i,keta(a)){ c+=b[i]-'0'; } return c; } bool fe(int a,int b){ a%=10; b%=10; if(a==0) a=10; if(b==0) b=10; if(a>b) return true; else return false; } int INF=1000000007; struct edge{int s,t,d; }; V<int> mojisyu(string a){ V<int> b(26,0); fo(i,a.sz){ b[a[i]-'a']++; } return b; } int wa2(int a){ if(a%2==1) return a/2; return a/2-1; } /*signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } } ?*/ int nCr(int n,int r){ int a=1; r=min(r,n-r); for(int i=n;i>n-r;i--){ a*=i; a/=n-i+1; } return a; } /*void sea(int x,int y){ if(x<0||a<=x||y<0||b<=y||c[x][y]=='#') return; if(d[x][y]) return; d[x][y]++; sea(x+1,y); sea(x-1,y); sea(x,y+1); sea(x,y-1); }*/ int kaijou(int a){ int b=1; fo(i,a) b*=i+1; return b; } int nPr(int a,int b){ if(a<b) return 0; if(b==0) return 1; int c=1; for(int i=a;i>a-b;i--){ c*=i; c%=INF; } return c; } int modinv(int a,int m){ int b=m,u=1,v=0; while(b){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); } u%=m; if(u<0) u+=m; return u; } int lcm(int a,int b){ int c=modinv(gcm(a,b),INF); return ((a*c)%INF)*(b%INF)%INF; } int MOD=INF; int fac[1000010], finv[1000010], inv[1000010]; // テーブルを作る前処理 //先にCOMinit()で前処理をする //ABC145D void COMinit() { fac[0]=fac[1]=1; finv[0]=finv[1]=1; inv[1]=1; for(int i=2;i<1000010;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; } } // 二項係数計算 int 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; } bool naka(int a,int b,V<V<char>> c){ return (a>=0&&b>=0&&a<c.sz&&b<c[0].sz); } V<P<int,int>> mawari8={{0,-1},{0,1},{1,0},{-1,0},{-1,-1},{1,1},{1,-1},{-1,-1}}; int inf=1000000000000000007; /* signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } }*/ V<P<int,int>> mawari4={{0,-1},{0,1},{1,0},{-1,0}}; //最短経路の表 a(全部INFで初期化) //縦横 x,y //迷路 f //スタートsx,sy //ゴールgx,gy //文字はgから使おうね /*int bfs_haba(){ Q<P<int,int>> b; a[sx][sy]=0; b.push({sx,sy}); while(!b.empty()){ P<int,int> c=b.front(); b.pop(); if(c.fi==gx&&c.se==gy){ break; } fo(i,4){ int d=c.fi+mawari4[i].fi; int e=c.se+mawari4[i].se; if(0<=d&&0<=e&&d<x&&e<y&&f[d][e]!='#'&&a[d][e]==INF){ b.push({d,e}); a[d][e]=1+a[c.fi][c.se]; } } } return a[gx][gy]; }*/ V<int> onajibubun(string a){ V<int> b(a.sz); for(int i=1,j=0;i<a.sz;i++){ if(i+b[i-j]<j+b[j]) b[i]=b[i-j]; else{ int c=max<int>(0,j+b[j]-i); while(i+c<a.sz&&a[c]==a[i+c]) c++; b[i]=c; j=i; } } b[0]=a.sz; return b; } //各頂点ごとにどこに辺が出てるかの表がc //各頂点ごとの色を表すV<int>(頂点数max)のcolorを用意する //aはどこ塗るか、bは何で塗るかなので、(0,1,c)でよぶとおけ V<int> color(205); bool nibu_hantei(int a,int b,V<V<int>> c){ color[a]=b; fo(i,c[a].sz){ if(b==color[c[a][i]]) return false; if(color[c[a][i]]==0&&!nibu_hantei(c[a][i],-b,c)) return false; } return true; } //aは頂点数 //nibu_hanteiの上にcolorを用意する //各頂点ごとにどこに辺が出てるかの表がc bool renketujanai_nibu_hantei(int a,V<V<int>> c){ fo(i,a){ if(color[i]==0){ if(!nibu_hantei(i,1,c)) return false; } } return true; } signed main(){ int a,b; cin>>a>>b; V<P<int,int>> c(a); fo(i,a){ cin>>c[i].fi; c[i].se=i+1; } Sort(c); rev(c); if(c[0]+c[1]<b){ cout<<"Impossible"<<endl; return 0; } rev(c); fo(i,a-1){ cout<<c[i].se<<endl; } }
a.cc: In function 'int main()': a.cc:381:10: error: no match for 'operator+' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'}) 381 | if(c[0]+c[1]<b){ In file included from /usr/include/c++/14/bits/stl_algobase.h:67, 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_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:381:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'const std::reverse_iterator<_Iterator>' 381 | if(c[0]+c[1]<b){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:381:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'const std::move_iterator<_IteratorL>' 381 | if(c[0]+c[1]<b){ | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:381:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 381 | if(c[0]+c[1]<b){ | ^ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:381:14: note: mismatched types 'const _CharT*' and 'std::pair<long long int, long long int>' 381 | if(c[0]+c[1]<b){ | ^ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:381:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 381 | if(c[0]+c[1]<b){ | ^ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:381:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 381 | if(c[0]+c[1]<b){ | ^ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:381:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 381 | if(c[0]+c[1]<b){ | ^ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:381:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 381 | if(c[0]+c[1]<b){ | ^ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:381:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 381 | if(c[0]+c[1]<b){ | ^ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:381:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 381 | if(c[0]+c[1]<b){ | ^ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:381:14: note: mismatched types 'const _CharT*' and 'std::pair<long long int, long long int>' 381 | if(c[0]+c[1]<b){ | ^ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:381:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 381 | if(c[0]+c[1]<b){ | ^ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, clas
s406930822
p04035
C++
#define s second #define rep(i, a, b) for(int i = int(a); i <= int(b); ++i) using namespace std; int arr[100005]; int main(){ faster int T = 1; while(T--){ int n,l; cin>>n>>l; rep(i,0,n-1) { cin>>arr[i]; } int ind; int f = 0; rep(i,0,n-2){ if(arr[i]+arr[i+1] >= l){ f = 1; ind = i; break; } } if(!f){ cout<<"Impossible"; } else{ cout<<"Possible\n"; for(int i=0; i<ind; i++){ cout<<i+1<<" "; } for(int i=n-2; i>ind; i--){ cout<<i+1<<" "; } cout<<ind+1; } } return 0; }
a.cc: In function 'int main()': a.cc:8:5: error: 'faster' was not declared in this scope 8 | faster | ^~~~~~ a.cc:10:11: error: 'T' was not declared in this scope 10 | while(T--){ | ^ a.cc:12:9: error: 'cin' was not declared in this scope 12 | cin>>n>>l; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | #define s second a.cc:31:13: error: 'cout' was not declared in this scope 31 | cout<<"Impossible"; | ^~~~ a.cc:31:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:33:13: error: 'cout' was not declared in this scope 33 | cout<<"Possible\n"; | ^~~~ a.cc:33:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s603160756
p04035
C++
#include<iostream> #include<string> using namespace std; int main(){ int n,l cin>>n>>l; int a[n]; for(int i=0;i<n;i++){ cin>>a[i]; } cout<<"Impossible"; return 0; }
a.cc: In function 'int main()': a.cc:9:5: error: expected initializer before 'cin' 9 | cin>>n>>l; | ^~~
s557399431
p04035
C++
#include<iostream> #include<string> using namespace std; int main(){ int n,l cin>>n>>l; int a[n]; for(int i=0;i<l;i++){ cin>>a[i]; } cout<<"Impossible"; return 0; }
a.cc: In function 'int main()': a.cc:9:5: error: expected initializer before 'cin' 9 | cin>>n>>l; | ^~~ a.cc:11:19: error: 'l' was not declared in this scope 11 | for(int i=0;i<l;i++){ | ^
s024548288
p04035
C++
#include<bits/stdc++.h> using namespace std; const int a=100001; int main() { int n, l, k, A[a]; cin>>n>>l; for (int i = 0; i < n; i ++) cin>>A[i]; for (int i = 1; i < n; i ++) if (A[i] + A[i + 1] >= l) k = i; if (!k) return cout<<"Impossible"<<endl; cout<<"Possible<<endl; for (int i = n - 1; i > k; i --) cout<<i<<endl; for (int i = 1; i <= id; i ++) cout<<i<<endl; return 0; }
a.cc:15:11: warning: missing terminating " character 15 | cout<<"Possible<<endl; | ^ a.cc:15:11: error: missing terminating " character 15 | cout<<"Possible<<endl; | ^~~~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:14:34: error: cannot convert 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'int' in return 14 | return cout<<"Impossible"<<endl; | ~~~~~~~~~~~~~~~~~~^~~~~~ | | | std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>} a.cc:16:5: error: expected primary-expression before 'for' 16 | for (int i = n - 1; i > k; i --) | ^~~ a.cc:16:25: error: 'i' was not declared in this scope 16 | for (int i = n - 1; i > k; i --) | ^ a.cc:18:26: error: 'id' was not declared in this scope; did you mean 'i'? 18 | for (int i = 1; i <= id; i ++) | ^~ | i
s357428783
p04035
C++
#include <bits/stdc++.h> #define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0); #define F first #define S second #define V vector #define PB push_back #define MP make_pair #define EB emplace_back #define ALL(v) (v).begin(), (v).end() #define debug(x) cerr << #x << " is " << x << endl using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef V<int> vi; const int INF = 1e9 + 7, N = 1e5 + 7; signed main() { IO_OP; int n, l; cin >> n >> l; for (int i = 0; i < n; i++) cin >> a[i]; bool ok = false, j; for (int i = 0; i < n - 1; i++) if (a[i] + a[i+1] >= l) { ok = true; j = i; } if (!ok) return cout << "Impossible" << endl, 0; cout << "Possible" << endl; for (int i = 1; i < j; i++) cout << i << endl; for (int i = n - 1; i >= j; i--) cout << i << endl; }
a.cc: In function 'int main()': a.cc:27:16: error: 'a' was not declared in this scope 27 | cin >> a[i]; | ^ a.cc:30:13: error: 'a' was not declared in this scope 30 | if (a[i] + a[i+1] >= l) { | ^
s500117362
p04035
C++
#include<iostream> using namespace std; typedef long long ll; ll num[100005]={0}; int main(){ ll n,x; cin>>n>>x; for(int i=1;i<=n;i++) cin>>num[i]; ll ok_l=0; for(int i=1;i<n;i++){ if(num[i]+num[i+1]>=x) ok_l=i; } if(ok_l==0){ cout<<"Impossible"<<endl; return 0; } cout<<"Possible"<<endl; for(int i=1;i<ok_l;i++) cout<<i<<endl; for(int i=n-1;i>ok_l;i--) cout<<i<<endl; cout<<ok_l<<endl; } #include<iostream> using namespace std; typedef long long ll; ll num[100005]={0}; int main(){ ll n,x; cin>>n>>x; for(int i=1;i<=n;i++) cin>>num[i]; ll ok_l=0; for(int i=1;i<n;i++){ if(num[i]+num[i+1]>=x) ok_l=i; } if(ok_l==0){ cout<<"Impossible"<<endl; return 0; } cout<<"Possible"<<endl; for(int i=1;i<ok_l;i++) cout<<i<<endl; for(int i=n-1;i>ok_l;i--) cout<<i<<endl; cout<<ok_l<<endl; }
a.cc:25:4: error: redefinition of 'll num [100005]' 25 | ll num[100005]={0}; | ^~~ a.cc:4:4: note: 'll num [100005]' previously defined here 4 | ll num[100005]={0}; | ^~~ a.cc:26:5: error: redefinition of 'int main()' 26 | int main(){ | ^~~~ a.cc:5:5: note: 'int main()' previously defined here 5 | int main(){ | ^~~~
s668665140
p04035
C++
#include <iostream> #include<algorithm> #include<vector> #define int long long using namespace std; int re(int i){return (i/2)*2;} int solve(int i,int j,int l){ return re(i)+re(j)+re(l); } #define vel vector<long long> int ret(int i,int j){ for(int k=i;k<=j;k++){ cout << k<<endl; } } signed main(void){ int n,l;cin >>n>>l; vel a(n); rep(i,n){cin >>a[i];} for(int i=0;i<n-1;i++){ if(a[i]+a[i+1]>=l){ cout << "Possible"<<endl; ret(1,i); ret(i+2,n-1); ret(i+1,i+1); return 0; } } cout << "Impossible"<<endl; }
a.cc: In function 'long long int ret(long long int, long long int)': a.cc:15:1: warning: no return statement in function returning non-void [-Wreturn-type] 15 | } | ^ a.cc: In function 'int main()': a.cc:19:9: error: 'i' was not declared in this scope 19 | rep(i,n){cin >>a[i];} | ^ a.cc:19:5: error: 'rep' was not declared in this scope; did you mean 'ret'? 19 | rep(i,n){cin >>a[i];} | ^~~ | ret
s210906033
p04035
C++
#include <cassert> #include <cstdio> #include <cmath> #include <iostream> #include <iomanip> #include <sstream> #include <vector> #include <set> #include <map> #include <queue> #include <numeric> #include <algorithm> using namespace std; using lint = long long; constexpr int MOD = 1000000007, INF = 1010101010; constexpr lint LINF = 1LL << 60; template <class T> ostream &operator<<(ostream &os, const vector<T> &vec) { for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " "); return os; } #ifdef _DEBUG template <class T> void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; }; template <class Head, class... Tail> void dump(const char* str, Head &&h, Tail &&... t) { while (*str != ',') cerr << *str++; cerr << " = " << h << "\n"; dump(str + (*(str + 1) == ' ' ? 2 : 1), t...); } #define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__) #else #define DMP(...) ((void)0) #endif int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N, L; cin >> N >> L; RandNum ran; vector<int> a(N); for (int i = 0; i < N; i++) cin >> a[i]; DMP(a); bool ok = false; int memo = -1; for (int i = 0; i < N; i++) { if (a[i] + a[i + 1] >= L) { ok = true; memo = i; break; } } if (ok) { cout << "Possible" << "\n"; for (int i = 0; i < memo; i++) cout << i + 1 << "\n"; for (int i = N - 1; i > memo + 1; i--) cout << i << "\n"; cout << memo + 1 << "\n"; } else cout << "Impossible" << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:46:9: error: 'RandNum' was not declared in this scope 46 | RandNum ran; | ^~~~~~~
s132284329
p04035
C++
nya~n
a.cc:1:1: error: 'nya' does not name a type 1 | nya~n | ^~~
s491283929
p04035
C++
#include<cstdio> #include<cstdlib> #include<algorithm> #include<iostream> #include<queue> #include<vector> #include <bitset> #include<math.h> using namespace std; #define INF 10000000 #define MOD 1000000007 typedef long long ll; typedef pair<ll,int> P; int main(){ int N,ans; ll L,a[110000]; cin>>N>>L; for(int i=0;i<N;i++){ cin>>a[i]; } bool flag=false; for(int i=0;i<N-1;i++){ if(a[i]+a[i+1]>=L){ flag=true; ans=i+1; } } if(flag){ cout<<"Possible"<<endl; for(int i=1;i<N;i++){ if(ans==i) break; cout<<i<<endl; } for(int i-N-1;i>=0;i--){ if(ans==i) break; cout<<i<<endl; } cout<<ans<<endl; }else cout<<"Impossible"<<endl; }
a.cc: In function 'int main()': a.cc:35:18: error: expected ';' before '-' token 35 | for(int i-N-1;i>=0;i--){ | ^ | ; a.cc:35:27: error: expected ')' before ';' token 35 | for(int i-N-1;i>=0;i--){ | ~ ^ | ) a.cc:35:28: error: 'i' was not declared in this scope 35 | for(int i-N-1;i>=0;i--){ | ^
s745656573
p04035
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll N,L ; cin >> N >> L vector<ll> A(N); for(ll i = 0; i < N; i++){ cin >> A[i];} for(ll i = 0; i < N-1; i++){ if(A[i]+A[i+1] >= L){ cout << "Possible" << endl; for(int j = 1; j <= i; j++){ cout << j << endl;} for(int k = N-1; k >= i+2; k--){cout << k << endl;} cout << i+1 << endl; return 0;} } cout << "Impossible" << endl; return 0;}
a.cc: In function 'int main()': a.cc:5:24: error: expected ';' before 'vector' 5 | ll N,L ; cin >> N >> L | ^ | ; 6 | vector<ll> A(N); | ~~~~~~ a.cc:7:37: error: 'A' was not declared in this scope 7 | for(ll i = 0; i < N; i++){ cin >> A[i];} | ^ a.cc:8:35: error: 'A' was not declared in this scope 8 | for(ll i = 0; i < N-1; i++){ if(A[i]+A[i+1] >= L){ | ^
s047094987
p04035
C++
#include <bits/stdc++.h> typedef long long; const int N = 1e5 + 5; int n, l; ll a[N]; int main() { scanf("%d%lld", &n, &l); int mark = 0; for (int i = 1; i <= n; i ++) { scanf("%lld", &a[i]); if (a[i] + a[i - 1] >= l) mark = i; } if (mark == 0) { printf("Impossible"); } else { mark --; printf("Possible\n"); for (int i = 1; i < n; i ++) if (i != mark) printf("%d\n", i); printf("%d", mark); } return 0; }
a.cc:3:14: error: declaration does not declare anything [-fpermissive] 3 | typedef long long; | ^~~~ a.cc:8:1: error: 'll' does not name a type 8 | ll a[N]; | ^~ a.cc: In function 'int main()': a.cc:16:32: error: 'a' was not declared in this scope 16 | scanf("%lld", &a[i]); | ^
s274040095
p04035
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define rep(i,n) for(int i=0;i<(n);i++) signed main(){ int n,l;cin>>n>>l; vector<int>a(n); for(auto&& u:a)cin>>u; int tmp=-1; rep(i,n-1)if(a[i]+a[i+1]>=l){tmp=i;break;} if(tmp=-1){ cout<<"Impossible"<<endl; }else{ cout<<"Possible"<<endl; for(int i=0;i<tmp;i++)cout<<i+1<<endl; for(int n-1;i>tmp;i--)cout<<i+1<<endl; cout<<tmp+1<<endl; } }
a.cc: In function 'int main()': a.cc:17:18: error: expected ';' before '-' token 17 | for(int n-1;i>tmp;i--)cout<<i+1<<endl; | ^ | ; a.cc:17:21: error: 'i' was not declared in this scope 17 | for(int n-1;i>tmp;i--)cout<<i+1<<endl; | ^ a.cc:17:26: error: expected ')' before ';' token 17 | for(int n-1;i>tmp;i--)cout<<i+1<<endl; | ~ ^ | ) a.cc:17:27: error: 'i' was not declared in this scope 17 | for(int n-1;i>tmp;i--)cout<<i+1<<endl; | ^
s074540167
p04035
C++
#include<bits/stdc++.h> using namespace std; #define IL inline #define rep(i,j,k) for(int i=j;i<=k;++i) #define repd(i,j,k) for(int i=j;i>=k;--i) #define pb push_back #define db double #define mp make_pair #define mp3(a,b,c) mp(mp(a,b),c) #define pii pair<int,int> #define piii pair<pii,int> #define fr first #define se second #define ll long long #define ull unsigned long long #define pbc(x) __builtin_popcount(x) #define clr(x) memset(x,0,sizeof x) #define SIZE(x) (int)(x.size()) const int mod=1e9+7; IL int pls(int x,int y){x+=y;return x>=mod?x-mod:x;} IL int dec(int x,int y){x-=y;return x<0?x+mod:x;} IL int mul(int x,int y){return 1ll*x*y%mod;} IL int mul(int x,int y,int z){return mul(mul(x,y),z);} IL int mul(int x,int y,int z,int p){return mul(mul(x,y),mul(z,p));} IL void add(int &x,int y){x+=y;x=(x>=mod)?x-mod:x;} IL int fpw(int x,int y,int r=1){for(;y;y>>=1,x=mul(x,x))if(y&1)r=mul(r,x);return r;} IL int inv(int x){return fpw(x,mod-2);} IL int gi(){int x;int _w=scanf("%d",&x);return x;} IL void gi(int &x){int _w=scanf("%d",&x);} IL void write(int x){printf("%d\n",x);} void chkmax(int &x,int y){x=(x>y)?x:y;} void chkmin(int &x,int y){x=(x<y)?x:y;} const int INF=0x3f3f3f3f; template<typename T>IL void debug(T x){cerr<<x;return;} /* --------------------------------------------------------------------------------------------------------- */ int main(){ int n=gi(),l=gi(); static int a[200000]; rep(i,1,n)a[i]=gi(); int p=0,mx=0; rep(i,1,n-1)if(a[i]+a[i+1]>mx)mx=a[i]+a[i+1],p=i; if(mx<l)puts("Impossible"); else{ puts("Possible"); rep(i,1,p-1)write(i); repd(i,n-1,j+1)write(i); write(p); } return 0; }
a.cc: In function 'int main()': a.cc:47:28: error: 'j' was not declared in this scope 47 | repd(i,n-1,j+1)write(i); | ^ a.cc:5:36: note: in definition of macro 'repd' 5 | #define repd(i,j,k) for(int i=j;i>=k;--i) | ^
s547225952
p04035
C++
#include <iostream> #include <iomanip> #include <vector> #include <set> #include <map> #include <queue> #include <deque> #include <algorithm> #include <cmath> #include <cstring> using namespace std; #define REP(i,n) for(int i = 0; i < n; i++) #define RREP(i,n) for(int i = n - 1; i >= 0; i--) #define ALL(v) v.begin(),v.end() #define pb push_back #define mp make_pair #define F first #define S second #define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ); #define y0 y3487465 #define y1 y8687969 #define m0(x) memset(x,0,sizeof(x)) #define m1(x) memset(x,63,sizeof(x)) typedef long long ll; typedef pair<int,int> pi; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pi> vpi; typedef vector<ll> vll; typedef vector<vll> vvll; double EPS = 1e-9; int INFi = 1000000005; long long INFll = 1000000000000000005ll; double PI = acos(-1); int dirx[8] = {-1,0,0,1,-1,-1,1,1}; int diry[8] = {0,1,-1,0,-1,1,-1,1}; ll MOD = 1000000007; const int MAX_N = 100000; int n, l; int a[MAX_N]; int main(){ cin >> n >> l; REP(i, n) cin >> a[i]; int x = n; REP(i, n - 1) { if(a[i] + a[i + 1] >= l) { x = i; break; } } if(x == n) { cout << "Impossible" << endl; } else { cout << "Possible" << endl; REP(i, x) cout << i + 1 << " " << endl; REP(i, n - 1 - x) cout << n - 1 - i << " " << endl; } return 0; } #include <iostream> #include <vector> #include <queue> #include <algorithm> #include <cmath> #include <iomanip> #include <map> #include <deque> #include <string.h> using namespace std; #define REP(i,n) for(int i = 0; i < n; i++) #define ALL(v) v.begin(),v.end() typedef long long ll; typedef pair<int,int> pi; typedef pair<ll,ll> pll; typedef pair<string,string> pss; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pi> vpi; typedef vector<ll> vll; typedef vector<vll> vvll; double EPS = 1e-9; int INFi = 1000000005; long long INFll = 1000000000000000005ll; double PI = acos(-1); int dirx[8] = {-1,0,0,1,-1,-1,1,1}; int diry[8] = {0,1,-1,0,-1,1,-1,1}; ll MOD = 1000000007; const int MAX_N = 100000; int n, l; int a[MAX_N]; int main(){ cin >> n >> l; REP(i, n) cin >> a[i]; int x = n; REP(i, n - 1) { if(a[i] + a[i + 1] >= l) { x = i; break; } } if(x == n) { cout << "Impossible" << endl; } else { cout << "Possible" << endl; REP(i, x) cout << i + 1 << " " << endl; REP(i, n - 1 - x) cout << n - 1 - i << " " << endl; } return 0; }
a.cc:97:8: error: redefinition of 'double EPS' 97 | double EPS = 1e-9; | ^~~ a.cc:40:8: note: 'double EPS' previously defined here 40 | double EPS = 1e-9; | ^~~ a.cc:98:5: error: redefinition of 'int INFi' 98 | int INFi = 1000000005; | ^~~~ a.cc:41:5: note: 'int INFi' previously defined here 41 | int INFi = 1000000005; | ^~~~ a.cc:99:11: error: redefinition of 'long long int INFll' 99 | long long INFll = 1000000000000000005ll; | ^~~~~ a.cc:42:11: note: 'long long int INFll' previously defined here 42 | long long INFll = 1000000000000000005ll; | ^~~~~ a.cc:100:8: error: redefinition of 'double PI' 100 | double PI = acos(-1); | ^~ a.cc:43:8: note: 'double PI' previously defined here 43 | double PI = acos(-1); | ^~ a.cc:101:5: error: redefinition of 'int dirx [8]' 101 | int dirx[8] = {-1,0,0,1,-1,-1,1,1}; | ^~~~ a.cc:44:5: note: 'int dirx [8]' previously defined here 44 | int dirx[8] = {-1,0,0,1,-1,-1,1,1}; | ^~~~ a.cc:102:5: error: redefinition of 'int diry [8]' 102 | int diry[8] = {0,1,-1,0,-1,1,-1,1}; | ^~~~ a.cc:45:5: note: 'int diry [8]' previously defined here 45 | int diry[8] = {0,1,-1,0,-1,1,-1,1}; | ^~~~ a.cc:103:4: error: redefinition of 'll MOD' 103 | ll MOD = 1000000007; | ^~~ a.cc:46:4: note: 'll MOD' previously defined here 46 | ll MOD = 1000000007; | ^~~ a.cc:105:11: error: redefinition of 'const int MAX_N' 105 | const int MAX_N = 100000; | ^~~~~ a.cc:48:11: note: 'const int MAX_N' previously defined here 48 | const int MAX_N = 100000; | ^~~~~ a.cc:106:5: error: redefinition of 'int n' 106 | int n, l; | ^ a.cc:49:5: note: 'int n' previously declared here 49 | int n, l; | ^ a.cc:106:8: error: redefinition of 'int l' 106 | int n, l; | ^ a.cc:49:8: note: 'int l' previously declared here 49 | int n, l; | ^ a.cc:107:5: error: redefinition of 'int a [100000]' 107 | int a[MAX_N]; | ^ a.cc:50:5: note: 'int a [100000]' previously declared here 50 | int a[MAX_N]; | ^ a.cc:109:5: error: redefinition of 'int main()' 109 | int main(){ | ^~~~ a.cc:52:5: note: 'int main()' previously defined here 52 | int main(){ | ^~~~
s345758764
p04035
C++
#include <iostream> #include <sstream> #include <functional> #include <algorithm> #include <cstring> #include <fstream> #include <cmath> #include <queue> #include <vector> #include <bits/stdc++.h> using namespace std; # define my_sizeof(type) ((char *)(&type+1)-(char*)(&type)) string makestring(int x) { stringstream ss; ss << x; return ss.str(); } int main() { int n, l, t, c, x; vector<int> v; cin >> n >> l; for(int i = 0; i < n; i++){ cin >> t; v.push_back(t); } for(int i = 0; i < n-1; i++){ t=v[i]+v[i+1]; if(c<t){ c=t; x=i; } } if(c<l){ cout << "Impossible"; } else { cout << "Possible" << endl; for(int i = 1; i < x; i++){ cout << i << endl; } for(int i = n-1; i > =x; i--){ cout << i << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:47:30: error: expected primary-expression before '=' token 47 | for(int i = n-1; i > =x; i--){ | ^
s641845675
p04035
C++
#include <iostream> #include <sstream> #include <functional> #include <algorithm> #include <cstring> #include <fstream> #include <cmath> #include <queue> #include <vector> #include <bits/stdc++.h> using namespace std; # define my_sizeof(type) ((char *)(&type+1)-(char*)(&type)) string makestring(int x) { stringstream ss; ss << x; return ss.str(); } int main() { int n, l, t, c, x; vector<int> v; cin >> n >> l; for(int i = 0; i < n; i++){ cin >> t; v.push_back(t); } for(int i = 0; i < n-1; i++){ t=v[i]+v[i+1]; if(c<t){ c=t; x=i; } } if(c<l){ cout << "Impossible"; } else { cout << "Possible" << endl; for(int i = 1; i < x; i++){ cout << i << endl; } for(int i = n-1; i > =x; i--){ cout << i << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:47:30: error: expected primary-expression before '=' token 47 | for(int i = n-1; i > =x; i--){ | ^
s992903706
p04035
C++
#include <bits/stdc++.h> using namespace std; int n, l; int main() { scanf("%d %d", &n, &l); vector<int> a(n); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } int last = 0; for (int i = 1; i <= n; i++) { if (a[i - 1] + a[i] >= l) { last = i; break; } } if (!last) { puts("Impossible") } else { puts("Possible"); for (int i = 1; i < last; i++) { printf("%d\n", i); } for (int i = n - 1; i >= last; i--) { printf("%d\n", i); } } }
a.cc: In function 'int main()': a.cc:21:23: error: expected ';' before '}' token 21 | puts("Impossible") | ^ | ; 22 | } else { | ~
s369336228
p04035
C++
#include <bits/stdc++.h> using namespace std; int n, l; int main() { scanf("%d %d", &n, &l); vector<int> a(n); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } int last = 0; for (int i = 1; i <= n; i++) { if (a[i - 1] + a[i] >= L) { last = i; break; } } if (!last) { puts("Impossible") } else { puts("Possible"); for (int i = 1; i < last; i++) { printf("%d\n", i); } for (int i = n - 1; i >= last; i--) { printf("%d\n", i); } } }
a.cc: In function 'int main()': a.cc:15:28: error: 'L' was not declared in this scope 15 | if (a[i - 1] + a[i] >= L) { | ^ a.cc:21:23: error: expected ';' before '}' token 21 | puts("Impossible") | ^ | ; 22 | } else { | ~
s243082930
p04035
C++
#include<bits/stdc++.h> using namespace std; #define ll long long int main(){ ll n,k,m=0; cin>>n>>k; ll a[i]; for(int i=0;i<n;i++){ cin>>a[i]; if(i!=0){ if(a[i]+a[i-1]>=k){ m=i; } } } if(m==0)cout<<"Impossible"; else{ cout<<"Possible"<<endl; for(int i=1;i<m;i++) cout<<i<<endl; for(int i=n-1;i>=m;i--) cout<<i<<endl; } }
a.cc: In function 'int main()': a.cc:7:8: error: 'i' was not declared in this scope 7 | ll a[i]; | ^ a.cc:9:10: error: 'a' was not declared in this scope 9 | cin>>a[i]; | ^
s273701907
p04035
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> p_int; typedef pair<ll,ll> p_ll; typedef tuple<ll,ll,ll> t3_ll; int dx[] = {-1,0,1,0},dy[] = {0,1,0,-1}; int prime[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97}; const ll inf = 1e9+7; int main() { bool ans=false; ll a,b;cin>>a>>b; ll x[a]; int pos; for(int i=0;i<a;i++){ cin>>x[i]; if(i!=0 && x[i-1]+x[i]>=b){ ans = true; pos = i; } } if(!ans){ cout<<"Impossible"<<endl; return 0; } cout<<"Possible"<<endl; for(int i=1;i<pos;i++){ cout <<i<<endl; } for(int i=n-1;i>pos;i--){ cout<<i<<endl; } }
a.cc: In function 'int main()': a.cc:32:19: error: 'n' was not declared in this scope 32 | for(int i=n-1;i>pos;i--){ | ^
s199773902
p04035
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> p_int; typedef pair<ll,ll> p_ll; typedef tuple<ll,ll,ll> t3_ll; int dx[] = {-1,0,1,0},dy[] = {0,1,0,-1}; int prime[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97}; const ll inf = 1e9+7; int main() { bool ans=false; ll a,b;cin>>a>>b; ll x[a]; int pos; for(int i=0;i<a;i++){ cin>>x[i]; if(i!=0 && x[i-1]+x[i]>=b){ ans = true; pos = i; } } if(!ans){ cout<<"Impossible"endl; return 0; } cout<<"Possible"<<endl; for(int i=1;i<pos;i++){ cout <<i<<endl; } for(int i=n-1;i>pos;i--){ cout<<i<<endl; } }
a.cc: In function 'int main()': a.cc:25:23: error: unable to find string literal operator 'operator""endl' with 'const char [11]', 'long unsigned int' arguments 25 | cout<<"Impossible"endl; | ^~~~~~~~~~~~~~~~ a.cc:32:19: error: 'n' was not declared in this scope 32 | for(int i=n-1;i>pos;i--){ | ^
s113470150
p04035
C
#include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> int main(void) { //変数の宣言 int n,l; int a[100010]; //よく使う変数 int i,j,k,l; int flag=0; long int ans=0; int count=0; int temp,temp1,temp2; int max,min; int len; //データの読み込み scanf("%d %d",&n,&l); for(i=0;i<n;i++){ scanf("%d",&a[i]); } // printf("nは%dです\n", n); // printf("データの読み込み終了\n"); //実際の処理 for(i=0;i<n-1;i++){ if(a[i]+a[i+1]>=l){ flag=1; break; } } if(flag==0){ printf("Impossible"); }else{ printf("Possible\n"); temp=i; for(i=1;i<=temp;i++){ printf("%d\n",i); } for(i=n-1;i>temp;i--){ printf("%d\n",i); } } // printf("計算部分終了\n"); //出力 // printf("結果の出力終了\n"); return 0; }
main.c: In function 'main': main.c:13:19: error: redeclaration of 'l' with no linkage 13 | int i,j,k,l; | ^ main.c:9:15: note: previous declaration of 'l' with type 'int' 9 | int n,l; | ^
s528333744
p04035
Java
import java.io.*; import java.util.StringTokenizer; public class Knot { public static void main(String[] args) throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); StringTokenizer st = new StringTokenizer(f.readLine()); int n = Integer.parseInt(st.nextToken()); int l = Integer.parseInt(st.nextToken()); int[] a = new int[n]; boolean can = false; int index = -1; StringTokenizer st1 = new StringTokenizer(f.readLine()); for (int i = 0; i < n; i++) { a[i] = Integer.parseInt(st1.nextToken()); } for (int i = 0; i < n-1; i++) { if((a[i]+a[i+1]) >=l ){ can = true; index = i; } } if (can == false) { out.println("Impossible"); } else { out.println("Possible"); for (int i = 0; i < index; i++) { out.println(i+1); } for (int i = index + 1; i < n - 1; i++) { out.println(i+1); } out.println(index+1); } out.close(); } }
Main.java:4: error: class Knot is public, should be declared in a file named Knot.java public class Knot { ^ 1 error
s926667925
p04035
C++
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ int n, l; cin >>n >>l; int a; b; int t =1; int k =0; cin << a; for(int i =1;i<n;i++){ cin <<b; if(l<a+b){ k =1; break;} a =b; t++ } if(k==1){ cout << " Possible " << endl; for(int i =1;i<t;i++){ cout << i << endl; } for(int i =n-1;i>t;i--){ cout << i <<endl; } cout << t; }else{ cout << "Impossible "; } return 0; }
a.cc: In function 'int main()': a.cc:8:12: error: 'b' was not declared in this scope 8 | int a; b; | ^ a.cc:11:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'long long int') 11 | cin << a; | ~~~ ^~ ~ | | | | | long long int | std::istream {aka std::basic_istream<char>} a.cc:11:9: note: candidate: 'operator<<(int, long long int)' (built-in) 11 | cin << a; | ~~~~^~~~ a.cc:11:9: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)' 1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin << a; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:11:5: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 11 | cin << a; | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin << a; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin << a; | ^ /usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)' 1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin << a; | ^ In file included from /usr/include/c++/14/bits/ios_base.h:46, from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin << a; | ^ In file included from /usr/include/c++/14/memory:80, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56: /usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)' 70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin << a; | ^ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin << a; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin << a; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 11 | cin << a; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 11 | cin << a; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 11 | cin << a; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin << a; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin << a; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 11 |
s674535787
p04035
C++
#include<bits/stdc++.h> using namespace std; long long a[100010]; long long b[100010]; int main() { int n,l; cin>>n>>l; for(int i=1;i<=n;i++) scanf("%d",&a[i]); long long ans=0; int pos=0; for(int i=1;i<n;i++) { if(a[i]+a[i+1]>ans) { ans=a[i]+a[i+1]; pos=i; } } if(ans>=l) { printf("Possible\n"); for(int i=n-1;i>j;i--) printf("%d\n",i); for(int i=1;i<j;i++) printf("%d\n",i); printf("%d\n",pos); } else { printf("Impossible\n"); } }
a.cc: In function 'int main()': a.cc:25:33: error: 'j' was not declared in this scope 25 | for(int i=n-1;i>j;i--) | ^ a.cc:27:31: error: 'j' was not declared in this scope 27 | for(int i=1;i<j;i++) | ^
s824107851
p04035
C++
#include<bits/stdc++.h> using namespace std; const int N=100005; int n; long long l; long long a[N]; int main() { scanf("%d%lld",&n,&l); long long maxn=0; int mid; for(int i=1;i<=n;i++) { scanf("%lld",&a[i]); if(i>1&&a[i-1]+a[i]>maxn) { maxn=a[i-1]+a[i]; mid=i-1; } } if(maxn>l) { printf("Possible\n"); for(int i=1;i<mid;i++) printf("%d\n",i); for(int j=n-1;j>mid;j--) printf("%d\n",i); printf("%d",mid); } else { printf("Impossible"); } return 0; }
a.cc: In function 'int main()': a.cc:27:31: error: 'i' was not declared in this scope 27 | printf("%d\n",i); | ^
s736734913
p04035
C++
#include<bits/stdc++.h> using namespace std; const int N=100005; int n; long long l; long long a[N]; int main() { scanf("%d%lld",&n,&l); long long maxn=0; int mid; for(int i=1;i<=n;i++) { scanf("%lld",&a[i]); if(i>1&&a[i-1]+a[i]>maxn) { maxn=a[i-1]+a[i]; mid=i-1; } } if(maxn>l) { printf("Possible\n"); for(int i=1;i<mid;i++) printf("%d\n",i); for(int j=n-1;j>mid;j--) printf("%d\n",i) printf("%d",mid); } else { printf("Impossible"); } return 0; }
a.cc: In function 'int main()': a.cc:27:31: error: 'i' was not declared in this scope 27 | printf("%d\n",i) | ^
s388237314
p04035
C++
#include<bits/stdc++.h> using namespace std; const int N=1e5+5; int n,L,a[N],i,j; int main(){ scanf("%d%d",&n,&L); for(i=1;i<=n;i++)scanf("%d",&a[i]); for(i=1,j=1;i<n;i++)if(a[i]+a[i+1]>a[j]+a[j+1])j=i; if(a[j]+a[j+1]<L){puts("Impossible");return;} puts("Possible"); for(i=n-1;i>j;i--)printf("%d\n",i); for(i=1;i<=j;i++)printf("%d\n",i); return 0; }
a.cc: In function 'int main()': a.cc:9:46: error: return-statement with no value, in function returning 'int' [-fpermissive] 9 | if(a[j]+a[j+1]<L){puts("Impossible");return;} | ^~~~~~
s696532537
p04035
C++
#include <bits/stdc++.h> using namespace std; int n, k; int a[100001]; vector <int> ans; int main () { cin >> n >> k; int pos = 0; for (int i = 1;i <= n;i ++) { cin >> a[i]; if (i > 1 && a[i] + a[i - 1] >= k) { pos = i - 1; } } if (!pos) { cout << "Impossible"; return 0; } cout << "Possible\n"; for (int i = 1;i < pos;i ++) ans.push_back (i); for (int i = pos + 1;i < n;i ++) ans.push_back (i); ans.push_back (pos); for (auto to : ans) cout << to << "\n" return 0; }
a.cc: In function 'int main()': a.cc:26:47: error: expected ';' before 'return' 26 | for (auto to : ans) cout << to << "\n" | ^ | ; 27 | return 0; | ~~~~~~
s163510242
p04035
C++
#include <iosteam> using namespace std; int main () { int a,b; bool ok = false; int d; cin >> a >> b; int c[a]; for (int i = 0;i < a;i++) { cin >> c[i]; } for (int i = 0;i < a - 1;i++){ if (c[i]+c[i+1] >= b) { ok = true; d = i; } } if (ok) { cout << "Possible" <<endl; for (int i = 1;i < d + 1;i++) cout << i << endl; for (int i = a - 1;d + 1 < i;i++) cout << i << endl; } else cout << "Impossible" << endl; }
a.cc:1:10: fatal error: iosteam: No such file or directory 1 | #include <iosteam> | ^~~~~~~~~ compilation terminated.
s716211232
p04035
C++
我是洛谷大佬
a.cc:1:1: error: '\U00006211\U0000662f\U00006d1b\U00008c37\U00005927\U00004f6c' does not name a type 1 | 我是洛谷大佬 | ^~~~~~~~~~~~
s175400058
p04035
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long n, l; cin >> n >> l; vector<long long> a(n); for(int i = 0; i < (int)n; i++){ cin >> a[i]; } bool flag = false; int idx; for(int i = 1; i < (int)n; i++){ if(a[i] + a[i - 1] >= l){ idx = i; flag true; break; } } if(!flag) puts("Impossoble"); else{ puts("Possible"); for(int i = 1; i < idx; i++){ cout << i << endl; } for(int i = idx + 1; i < (int)n; i++){ cout << i << endl; } cout << idx << endl; } return 0; }
a.cc: In function 'int main()': a.cc:18:17: error: expected ';' before 'true' 18 | flag true; | ^ ~~~~ | ;
s566434000
p04035
C++
#include <iostream> #include <climits> #include <stack> #include <queue> #include <string> #include <set> #include <map> #include <math.h> #include <algorithm> #include <vector> using namespace std; typedef long long ll; typedef pair<ll,ll> P; long long int INF = 1e18; double Pi = 3.141592653589; const int mod = 1000000007; // memset(a,0,sizeof(a)); →全部0にする vector<int> G[100005]; std::vector<P> tree[100010]; int dx[8]={1,0,-1,0,1,1,-1,-1}; int dy[8]={0,1,0,-1,1,-1,-1,1}; #define p(x) cout<<x<<endl; #define e cout<<endl; #define pe(x) cout<<x<<" "; #define re(i,a,b) for(i=a;i<=b;i++) ll i,j,k,l,ii,jj; ll n,m; ll x,y; ll ans=0; ll a[100005],b[100005]; ll sum=0; ll kazu=0; ll sita=0,ue=n-1; bool used[100005]; bool flag; int main(){ cin>>n>>l; for(i=0;i<n;i++){ cin>>a[i]; sum+=a[i]; } sita=0; ue=n-1; while(true){ if(ue!=sita && sum<l){ flag=true; break; } if(ue==sita){ flag=false; break; } if(a[sita]>a[ue]){ sum-=a[ue]; b[kazu]=ue; ue--; }else{ sum-=a[sita]; b[kazu]=sita+1; sita++; } kazu++; } if(flag){ p("Impossible"); }else{ p("Possible"); for(i=0;i<n-1;i++){ p(b[i]); } } return 0; } /*
a.cc:83:1: error: unterminated comment 83 | /* | ^
s251084345
p04035
C++
#include <iostream> int v[100000]; int main() { int n, k, i, maxx, poz1, poz2; cin >> n >> k >> v[0] ; maxx = 0; for( i = 1; i < n; i++ ) { cin >> v[i]; if( v[i - 1] + v[i] > maxx ) { maxx = v[i - 1] + v[i]; poz1 = i - 1; poz2 = i; } } if (maxx < k) { cout <<"Impossible"; return 0 ; } cout << "Possible\n" ; for( i = 1; i <= poz1; i++ ) { out << i << '\n' ; } for( i = n - 1; i > poz2; i-- ) { out << i << '\n' ; } cout << poz2 ; return 0; }
a.cc: In function 'int main()': a.cc:8:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 8 | cin >> n >> k >> v[0] ; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:22:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 22 | cout <<"Impossible"; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:25:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 25 | cout << "Possible\n" ; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:28:9: error: 'out' was not declared in this scope 28 | out << i << '\n' ; | ^~~ a.cc:32:9: error: 'out' was not declared in this scope 32 | out << i << '\n' ; | ^~~
s715508993
p04035
C++
#include <iostream> using namespace std; int v[100000] ; int main() { int n ,l ,i ,poz1 = 0 ,poz2 = 0 ,x ,y; cin >> n >> l ; for (i = 1 ; i <= n ; i ++) { cin >> v[i]; if (v[i] + v[i-1] >= maxx) { maxx = v[i] + v[i-1] ; poz2 = i ,poz1 = i - 1; } } if (maxx < k ) { cout << "Impossible" ; return 0 ; } cout << "Possible\n" ; for (i = 1 ; i <= poz1 ; ++ i) { cout << i << '\n' ; } for (i = n-1 ; i > poz2 ; i --) { cout << i << '\n'; } cout << poz2 ; return 0; }
a.cc: In function 'int main()': a.cc:14:30: error: 'maxx' was not declared in this scope 14 | if (v[i] + v[i-1] >= maxx) | ^~~~ a.cc:21:9: error: 'maxx' was not declared in this scope 21 | if (maxx < k ) | ^~~~ a.cc:21:16: error: 'k' was not declared in this scope 21 | if (maxx < k ) | ^
s026976737
p04035
C++
#include <iostream> using namespace std; int v[100000] ; int main() { int n ,l ,i ,poz1 = 0 ,poz2 = 0 ,x ,y; cin >> n >> l ; for (i = 1 ; i <= n ; i ++) { cin >> v[i]; if (v[i] + v[i-1] >= l) poz2 = i ,poz1 = i - 1; } if (poz1 == 0 && poz2 == 0) { cout << "Impossible" ; return 0 ; } cout << "Possible\n" ; for (i = 1 ; i <= poz1 ; ++ i) { cout << i << '\n' ; } for (i = n-1 ; i >b ; i --) { cout << i << '\n'; } cout << poz1 ; return 0; }
a.cc: In function 'int main()': a.cc:27:23: error: 'b' was not declared in this scope 27 | for (i = n-1 ; i >b ; i --) | ^
s903631099
p04035
C++
#include <bits/stdc++.h> using namespace std; int v[100000]; long long s; int main() { int n, k; cin>>n>>k; for (it i=0; i<n; i++){ cin>>v[i]; s+=v[i]; } if (s<k){ cout<<"impossible"; return 0; } }
a.cc: In function 'int main()': a.cc:9:10: error: 'it' was not declared in this scope; did you mean 'int'? 9 | for (it i=0; i<n; i++){ | ^~ | int a.cc:9:18: error: 'i' was not declared in this scope 9 | for (it i=0; i<n; i++){ | ^
s802429927
p04035
C++
// ConsoleApplication2.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <algorithm> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <type_traits> #include <vector> typedef long long int ll; #define FOR(i, a, b) for (ll i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define EREP(i, n) for (int i = (n - 1); i >= 0; --i) #define mod 100000 #define INF 93193111451418101 #define MIN -933111451418101 #define pb push_back using namespace std; typedef pair<ll, ll> P; /*template <typename T, typename U> std::enable_if_t<std::rank<T>::value == 0> fill_all(T &arr, const U &v) { arr = v; } template <typename ARR, typename U> std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR &arr, const U &v) { for (auto &i : arr) { fill_all(i, v); } }*/ //------------------?????°-----------------------// ll n, l; vector<ll>v, cl; //-------------------??¢??°----------------------// int main() { cin >> n >> l; ll goukei = 0; REP(i, n) { ll hoge; cin >> hoge; v.pb(hoge); goukei += hoge;//合計を求める } ll fr = 0, ba = v.size() - 1; REP(i, n - 2) { if (v[fr] <= v[ba ] ) {//もし左端のほうが小さければ goukei -= v[fr ]; cl.pb(fr + 1); fr++; } else {//右端のほうが小さければ goukei -= v[ba]; cl.pb(ba);//ほどく ba--; } if (goukei < l) {//もし規定値を超えていたら cout << "Impossible" << endl; return 0; } } if (n <= 2) {//nが2以下は例外 if (goukei >= l) { cout << "Possible" << endl << 1 << endl; } else { cout << "Impossible" << endl; } return 0; } cout << "Possible" << endl; REP(i, cl.size()) { cout << cl[i] << endl; } cout << fr+1 << endl; return 0; }
a.cc:4:10: fatal error: stdafx.h: No such file or directory 4 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s719917954
p04035
C++
// ConsoleApplication2.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <algorithm> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <type_traits> #include <vector> typedef long long int ll; #define FOR(i, a, b) for (ll i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define EREP(i, n) for (int i = (n - 1); i >= 0; --i) #define mod 100000 #define INF 93193111451418101 #define MIN -933111451418101 #define pb push_back using namespace std; typedef pair<ll, ll> P; /*template <typename T, typename U> std::enable_if_t<std::rank<T>::value == 0> fill_all(T &arr, const U &v) { arr = v; } template <typename ARR, typename U> std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR &arr, const U &v) { for (auto &i : arr) { fill_all(i, v); } }*/ //------------------?????°-----------------------// ll n, l; vector<ll>v, cl; //-------------------??¢??°----------------------// int main() { cin >> n >> l; ll goukei = 0; REP(i, n) { ll hoge; cin >> hoge; v.pb(hoge); goukei += hoge; } ll fr = 0, ba = v.size() - 1; REP(i, n - 2) { if (v[fr] <= v[ba ] ) { goukei -= v[fr ]; cl.pb(fr + 1); fr++; } else { goukei -= v[ba]; cl.pb(ba); ba--; } if (goukei < l) {//もし規定値を超えていたら cout << "Impossible" << endl; return 0; } } if (n <= 2) { if (goukei >= l) { cout << "Possible" << endl << 1 << endl; } else { cout << "Impossible" << endl; } return 0; } cout << "Possible" << endl; REP(i, cl.size()) { cout << cl[i] << endl; } cout << fr+1 << endl; return 0; }
a.cc:4:10: fatal error: stdafx.h: No such file or directory 4 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s709366412
p04035
C++
// ConsoleApplication2.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <algorithm> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <type_traits> #include <vector> typedef long long int ll; #define FOR(i, a, b) for (ll i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define EREP(i, n) for (int i = (n - 1); i >= 0; --i) #define mod 100000 #define INF 93193111451418101 #define MIN -933111451418101 #define pb push_back using namespace std; typedef pair<ll, ll> P; /*template <typename T, typename U> std::enable_if_t<std::rank<T>::value == 0> fill_all(T &arr, const U &v) { arr = v; } template <typename ARR, typename U> std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR &arr, const U &v) { for (auto &i : arr) { fill_all(i, v); } }*/ //------------------?????°-----------------------// ll n, l; vector<ll>v, cl; //-------------------??¢??°----------------------// int main() { cin >> n >> l; ll goukei = 0; REP(i, n) { ll hoge; cin >> hoge; v.pb(hoge); goukei += hoge; } ll fr = 0, ba = v.size() - 1; REP(i, n - 2) { if (v[fr] < v[ba ] ) { goukei -= v[fr ]; cl.pb(fr + 1); fr++; } else { goukei -= v[ba]; cl.pb(ba); ba--; } if (goukei < l) {//もし規定値を超えていたら cout << "Impossible" << endl; return 0; } } if (n >= 2) { if (goukei >= l) { cout << "Possible" << endl << 1 << endl; } else { cout << "Impssible" << endl; } return 0; } cout << "Possible" << endl; REP(i, cl.size()) { cout << cl[i] << endl; } cout << fr+1 << endl; return 0; }
a.cc:4:10: fatal error: stdafx.h: No such file or directory 4 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s142259642
p04035
C++
// ConsoleApplication2.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <algorithm> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <type_traits> #include <vector> typedef long long int ll; #define FOR(i, a, b) for (ll i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define EREP(i, n) for (int i = (n - 1); i >= 0; --i) #define mod 100000 #define INF 93193111451418101 #define MIN -933111451418101 #define pb push_back using namespace std; typedef pair<ll, ll> P; /*template <typename T, typename U> std::enable_if_t<std::rank<T>::value == 0> fill_all(T &arr, const U &v) { arr = v; } template <typename ARR, typename U> std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR &arr, const U &v) { for (auto &i : arr) { fill_all(i, v); } }*/ //------------------?????°-----------------------// ll n, l; vector<ll>v, cl; //-------------------??¢??°----------------------// int main() { cin >> n >> l; ll goukei = 0; REP(i, n) { ll hoge; cin >> hoge; v.pb(hoge); goukei += hoge; } ll fr = 0, ba = v.size() - 1; REP(i, n - 2) { if (v[fr] < v[ba ] ) { goukei -= v[fr ]; cl.pb(fr + 1); fr++; } else { goukei -= v[ba]; cl.pb(ba); ba--; } if (goukei < l) {//もし規定値を超えていたら cout << "Impossible" << endl; return 0; } } cout << "Possible" << endl; REP(i, cl.size()) { cout << cl[i] << endl; } cout << fr+1 << endl; return 0; }
a.cc:4:10: fatal error: stdafx.h: No such file or directory 4 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s986880734
p04035
C++
#include <iostream> #include <vector> using namespace std; typedef pair<int ,int> P; int main(void){ int n, l, ans = 0; int a[100005]; int length[100005]; cin >> n >> l; vector<int> front; vector<int> back; for(int i=0; i<n; i++){ cin >> a[i]; } for(int i=0; i<n-1; i++){ length[i] = a[i] + a[i+1]; if(length[i] >= l && ans == 0){ ans = i+1; }else{ if(ans == 0){ front.push_back(i); }else{ back.push_back(i); } } } reverse(back.begin(), back.end()); for(int i=0; i<back.size(); i++){ front.push_back(back[i]); } if(ans == 0){ cout << "Impossible" << endl; return 0; }else{ cout << "Possible" << endl; } for(int i=0; i<front.size(); i++){ cout << front[i]+1 << endl; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:27:5: error: 'reverse' was not declared in this scope 27 | reverse(back.begin(), back.end()); | ^~~~~~~