submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s076398175
p03937
C++
#include <iostream> using namespace std; int H, W; char field[8][8]; bool solve(int x, int y) { if (x >= H-1 && y >= W-1) return true; if (field[x+1][y] == '.' && field[x][y+1] == '.') { return false; } else if (field[x+1][y] == '#' && field[x][y+1] == '#') { return false; } else { if (field[x+1][y] == '#') { return solve(x+1, y); } else { return solve(x, y+1); } } } int main() { assert(false); cin >> H >> W; for (int i=0; i<H; i++) { for (int j=0; j<W; j++) { cin >> field[i][j]; } } if (solve(0, 0)) { cout << "Possible" << endl; } else { cout << "Impossible" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:24:3: error: 'assert' was not declared in this scope 24 | assert(false); | ^~~~~~ a.cc:2:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>' 1 | #include <iostream> +++ |+#include <cassert> 2 | using namespace std;
s001771890
p03937
C++
#ifndef __clang__ #pragma GCC optimize ("-O3") #endif #ifdef ONLINE_JUDGE #define NDEBUG 1 #endif #define _GLIBCXX_USE_CXX11_ABI 0 #include <stdio.h> #include <bits/stdc++.h> #define DESTRUCT2(p, a, b) \ auto a = get<0>(p); \ auto b = get<1>(p); #define DESTRUCT3(p, a, b, c) \ auto a = get<0>(p); \ auto b = get<1>(p); \ auto c = get<2>(p); #define DESTRUCT4(p, a, b, c, d) \ auto a = get<0>(p); \ auto b = get<1>(p); \ auto c = get<2>(p); \ auto d = get<3>(p); #define FOR(i, n) for(lli i = 0; i < (lli)(n); ++i) #define FORU(i, j, k) for(lli i = (j); i <= (lli)(k); ++i) #define FORD(i, j, k) for(lli i = (j); i >= (lli)(k); --i) #define SQ(x) ((x)*(x)) #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) #define mp make_pair #define mt make_tuple #define pb push_back #define eb emplace_back using namespace std; template<typename... As> struct tpl : public std::tuple<As...> { using std::tuple<As...>::tuple; template<typename T = tuple<As...> > typename tuple_element<0, T>::type const& x() const { return get<0>(*this); } template<typename T = tuple<As...> > typename tuple_element<0, T>::type& x() { return get<0>(*this); } template<typename T = tuple<As...> > typename tuple_element<1, T>::type const& y() const { return get<1>(*this); } template<typename T = tuple<As...> > typename tuple_element<1, T>::type& y() { return get<1>(*this); } template<typename T = tuple<As...> > typename tuple_element<2, T>::type const& z() const { return get<2>(*this); } template<typename T = tuple<As...> > typename tuple_element<2, T>::type& z() { return get<2>(*this); } template<typename T = tuple<As...> > typename tuple_element<3, T>::type const& w() const { return get<3>(*this); } template<typename T = tuple<As...> > typename tuple_element<3, T>::type& w() { return get<3>(*this); } }; using lli = long long int; using llu = long long unsigned; using pii = tpl<lli, lli>; using piii = tpl<lli, lli, lli>; using piiii = tpl<lli, lli, lli, lli>; using vi = vector<lli>; using vii = vector<pii>; using viii = vector<piii>; using vvi = vector<vi>; using vvii = vector<vii>; using vviii = vector<viii>; template<class T> using min_queue = priority_queue<T, vector<T>, greater<T> >; template<class T> using max_queue = priority_queue<T>; template<size_t... I> struct my_index_sequence { using type = my_index_sequence; static constexpr array<size_t, sizeof...(I)> value = { {I...} }; }; namespace my_index_sequence_detail { template<typename I, typename J> struct concat; template<size_t... I, size_t... J> struct concat<my_index_sequence<I...>, my_index_sequence<J...> > : my_index_sequence<I..., (sizeof...(I)+J)...> { }; template<size_t N> struct make_index_sequence : concat<typename make_index_sequence<N/2>::type, typename make_index_sequence<N-N/2>::type>::type { }; template <> struct make_index_sequence<0> : my_index_sequence<>{}; template <> struct make_index_sequence<1> : my_index_sequence<0>{}; } template<class... A> using my_index_sequence_for = typename my_index_sequence_detail::make_index_sequence<sizeof...(A)>::type; template<class T, size_t... I> void print_tuple(ostream& s, T const& a, my_index_sequence<I...>){ using swallow = int[]; (void)swallow{0, (void(s << (I == 0? "" : ", ") << get<I>(a)), 0)...}; } template<class T> ostream& print_collection(ostream& s, T const& a){ s << '['; for(auto it = begin(a); it != end(a); ++it){ s << *it; if(it != prev(end(a))) s << " "; } return s << ']'; } template<class... A> ostream& operator<<(ostream& s, tpl<A...> const& a){ s << '('; print_tuple(s, a, my_index_sequence_for<A...>{}); return s << ')'; } template<class... A> ostream& operator<<(ostream& s, tuple<A...> const& a){ s << '('; print_tuple(s, a, my_index_sequence_for<A...>{}); return s << ')'; } template<class A, class B> ostream& operator<<(ostream& s, pair<A, B> const& a){ return s << "(" << get<0>(a) << ", " << get<1>(a) << ")"; } template<class T, size_t I> ostream& operator<<(ostream& s, array<T, I> const& a) { return print_collection(s, a); } template<class T> ostream& operator<<(ostream& s, vector<T> const& a) { return print_collection(s, a); } template<class T, class U> ostream& operator<<(ostream& s, multimap<T, U> const& a) { return print_collection(s, a); } template<class T> ostream& operator<<(ostream& s, multiset<T> const& a) { return print_collection(s, a); } template<class T, class U> ostream& operator<<(ostream& s, map<T, U> const& a) { return print_collection(s, a); } template<class T> ostream& operator<<(ostream& s, set<T> const& a) { return print_collection(s, a); } namespace std { namespace { template <class T> inline void hash_combine(size_t& seed, T const& v) { seed ^= hash<T>()(v) + 0x9e3779b9 + (seed<<6) + (seed>>2); } template <class Tuple, size_t Index = tuple_size<Tuple>::value - 1> struct HashValueImpl { static void apply(size_t& seed, Tuple const& tuple) { HashValueImpl<Tuple, Index-1>::apply(seed, tuple); hash_combine(seed, get<Index>(tuple)); } }; template <class Tuple> struct HashValueImpl<Tuple, 0> { static void apply(size_t& seed, Tuple const& tuple) { hash_combine(seed, get<0>(tuple)); } }; } template <typename ... TT> struct hash<tuple<TT...>> { size_t operator()(tuple<TT...> const& tt) const { size_t seed = 0; HashValueImpl<tuple<TT...> >::apply(seed, tt); return seed; } }; template <typename ... TT> struct hash<tpl<TT...>> { size_t operator()(tpl<TT...> const& tt) const { size_t seed = 0; HashValueImpl<tuple<TT...> >::apply(seed, tt); return seed; } }; } int read_positive(){ char c; int x=0; do { c = getchar(); } while(c<'0' || c>'9'); while(c>='0'&&c<='9') { x=10*x+(c-'0'); c = getchar(); } return x; } //------------------------------------------------------------------------------ bool A[1000][1000]; int main(int, char**){ ios::sync_with_stdio(0); cin.tie(0); int n,m;cin>>n>>m; int nm=0; FOR(i,n) FOR(j,m) { char c; cin >> c; A[i][j] = c=='#'; } int x=0,y=0; if(!A[0][0]) goto fail; int e=1; while(x!=n-1||y!=m-1){ e+=1; if(A[x+1][y]) { x+=1; }else if(A[x][y+1]) { y+=1; }else{ goto fail; } } if(e!=nm) goto fail; cout << "Possible" << endl; fail: cout << "Impossible" << endl; return 0; }
a.cc: In function 'int main(int, char**)': a.cc:233:2: error: jump to label 'fail' 233 | fail: | ^~~~ a.cc:219:21: note: from here 219 | if(!A[0][0]) goto fail; | ^~~~ a.cc:220:7: note: crosses initialization of 'int e' 220 | int e=1; | ^
s461210186
p03937
C++
#include <iostream> #include <set> #include <vector> #include <string> #include <algorithm> #include <cmath> using namespace std; #define IN(n) int n;cin>>n #define IN_(n,n_) int n,n_;cin>>n>>n_; #define OUT(n) cout << n << endl #define OUT_(n,n_) cout << n << " " << n_ << endl #define v_(a,n,n_) vector<vector<a>>(n,vector<a>(n_)) //vector<vector<n>> initialize #define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++) #define REP(i,n) for(int i=0;i<(n);i++) #define REP_(i,n) for(int i=(n)-1;i>=0;i--) #define SORT(n) sort((n).begin(),(n).end()) #define ALL(n) (n).begin(),(n).end() #define TRY(n) try{n}catch(...){} typedef vector<int> vi; typedef vector<vector<int>> vii; typedef vector<string> vs; typedef vector<vector<char>> vcc; vcc a; void slv(int i,int j){ if(a[i][j] == '.')return; a[i][j] = '.'; TRY(if(a.at(i).at(j+1) == '#'){slv(i,j+1);}) TRY(if(a.at(i+1).at(j) == '#'){slv(i+1,j);}) } int main(){ IN_(h,w); a = v_(char,h,w); for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ cin>>a[i][j]; } } slv(0,0); bool f = true; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ if(a[i][j] == '#'){ f = false } } if(f)cout<<"Possible"<<endl; else cout<<"Impossible"<<endl; } }
a.cc: In function 'int main()': a.cc:50:26: error: expected ';' before '}' token 50 | f = false | ^ | ; 51 | } | ~
s755118953
p03937
C++
#include<iostream> #include<string> #include<cstring> using namespace std; int main() { int num1=0,num2=0; char test1[8][8]; cin>>num1>>num2; for(int i=0;i<num1:i++){ for(int q=0;q<num2;q++){ cin>>test1[i][q]; } } for(int w=0;w<num1-1;w++){ for(int r=0;r<num2;r++){ e=w+1; if(test1[w][r]=='#'){ for(int t=0;t<r;t++){ if(test1[e][t]=='#'){ cout<<"Impossible\n"; } } } } } cout<<"Possible\n"; return 0; }
a.cc: In function 'int main()': a.cc:11:21: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions] 11 | for(int i=0;i<num1:i++){ | ^ a.cc:11:27: error: found ':' in nested-name-specifier, expected '::' 11 | for(int i=0;i<num1:i++){ | ^ | :: a.cc:11:23: error: 'num1' is not a class, namespace, or enumeration 11 | for(int i=0;i<num1:i++){ | ^~~~ a.cc:16:9: error: expected primary-expression before 'for' 16 | for(int w=0;w<num1-1;w++){ | ^~~ a.cc:15:10: error: expected ';' before 'for' 15 | } | ^ | ; 16 | for(int w=0;w<num1-1;w++){ | ~~~ a.cc:16:9: error: expected primary-expression before 'for' 16 | for(int w=0;w<num1-1;w++){ | ^~~ a.cc:15:10: error: expected ')' before 'for' 15 | } | ^ | ) 16 | for(int w=0;w<num1-1;w++){ | ~~~ a.cc:11:12: note: to match this '(' 11 | for(int i=0;i<num1:i++){ | ^ a.cc:18:17: error: 'e' was not declared in this scope 18 | e=w+1; | ^
s611400989
p03937
C++
// AGC007A.cpp : コンソール アプリケーションのエントリ ポイントを定義します。 // #include "stdafx.h" #include<iostream> #include<vector> #include<string> #include<cstdio> #include<cmath> using namespace std; typedef long long ll; int h, w; char a[9][9]; bool judge() { int fx = 0; int fy = 0; a[fy][fx] = '.'; while (!(fx == w - 1 && fy == h - 1)) {//goal につくまで進める if (fx < w - 1 && fy < h - 1 && a[fy][fx + 1] == '#' && a[fy + 1][fx] == '.') {//右にあって下にない fx++; a[fy][fx] = '.'; } else if (fx < w - 1 && fy < h - 1 && a[fy][fx + 1] == '.' && a[fy + 1][fx] == '#') {//下にあって右にない fy++; a[fy][fx] = '.'; } else if (fx == w - 1 && a[fy + 1][fx] == '#') { fy++; a[fy][fx] = '.'; } else if (fy == h - 1 && a[fy][fx + 1] == '#') { fx++; a[fy][fx] = '.'; } else { //for (int i = 0; i < h; i++) { //for (int j = 0; j < w; j++) { //cout << a[i][j] << " "; //} //cout << endl; //} return false; } }//右下の経路は終わり a[h - 1][w - 1] = '.'; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { if (a[i][j] == '#')return false; } } //for (int i = 0; i < h; i++) { //for (int j = 0; j < w; j++) { //cout << a[i][j] << " "; //} //cout << endl; //} return true; } int main() { cin >> h >> w; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cin >> a[i][j]; } } cout << (judge() ? "Possible" : "Impossible" )<< endl; return 0; }
a.cc:4:10: fatal error: stdafx.h: No such file or directory 4 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s072676072
p03937
C++
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); // 1行、2つ(複数)数字 String[] ss0 = br.readLine().trim().split(" ", 0); int H = Integer.parseInt(ss0[0]); int W = Integer.parseInt(ss0[1]); String[][] ss2 = new String[H][W]; for(int h = 0; h < H; h++){ ss0 = br.readLine().trim().split("", 0); for(int w = 0; w < W; w++){ ss2[h][w] = new String(ss0[w]); } } ////入力値確認 //for(int m = 0; m < H; m++){ // for(int n = 0; n < W; n++){ // //System.out.print("[" + ss2[m][n] + "]"); // } // System.out.println(""); //} //進んだ後に、戻った跡があるとアウト int x = 0; int y = 0; boolean b = true; for(int h = 0; h < H; h++){ for(int w = 0; w < W; w++){ if (ss2[h][w].equals("#")){ if(w < y){ b = false; }else{ y = w; } if(h < x){ b = false; }else{ x = h; } } if(b){}else{ break; } } if(b){}else{ break; } } if (b) { System.out.println("Possible"); }else{ System.out.println("Impossible"); } //System.out.println(iCount + " " + s); return; } // Debug.Print static void dp(String s) { System.out.println(s); } static void dp(StringBuilder s) { dp(s.toString()); } static void dp(int i) { dp(String.valueOf(i)); } static void dp(long i) { dp(String.valueOf(i)); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.BufferedReader; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.io.InputStreamReader; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: expected unqualified-id before 'public' 4 | public class Main { | ^~~~~~
s274368782
p03937
C++
using System; class A { string[] Rs(){ return Console.ReadLine().Split(' '); } public void run(){ string[] HW = Rs(); int H = int.Parse(HW[0]), W = int.Parse(HW[1]); int[,] A = new int[H,W]; for(int i=0;i<H;i++){ string inp = Console.ReadLine(); for(int j=0;j<W;j++){ A[i,j] = (inp[j]=='#')?1:0; } } Func<int, int, bool> f = null; f = (x, y) =>{ if(x==H-1 && y==W-1) return true; bool ans = false; if( x<H-1 && A[x+1,y]==1 && (y==W-1 || (A[x,y+1]==0))){ ans = ans || f(x+1, y); } if( y<W-1&& A[x,y+1]==1 && (x==H-1 || (A[x+1,y] == 0))){ ans = ans || f(x, y+1); } return ans; }; if(f(0,0)){ Console.WriteLine("Possible"); } else { Console.WriteLine("Impossible"); } } } class Program { static void Main(string[] args){ A a = new A(); a.run(); } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:4:5: error: 'string' does not name a type 4 | string[] Rs(){ | ^~~~~~ a.cc:7:11: error: expected ':' before 'void' 7 | public void run(){ | ^~~~~ | : a.cc:38:2: error: expected ';' after class definition 38 | } | ^ | ; a.cc: In member function 'void A::run()': a.cc:8:9: error: 'string' was not declared in this scope 8 | string[] HW = Rs(); | ^~~~~~ a.cc:8:16: error: expected primary-expression before ']' token 8 | string[] HW = Rs(); | ^ a.cc:9:17: error: expected primary-expression before 'int' 9 | int H = int.Parse(HW[0]), W = int.Parse(HW[1]); | ^~~ a.cc:10:13: error: expected identifier before ',' token 10 | int[,] A = new int[H,W]; | ^ a.cc:10:13: error: expected ']' before ',' token a.cc:10:12: error: structured binding declaration cannot have type 'int' 10 | int[,] A = new int[H,W]; | ^ a.cc:10:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:10:12: error: empty structured binding declaration a.cc:10:16: error: expected initializer before 'A' 10 | int[,] A = new int[H,W]; | ^ a.cc:12:20: error: expected ';' before 'inp' 12 | string inp = Console.ReadLine(); | ^~~ a.cc:13:27: error: 'W' was not declared in this scope 13 | for(int j=0;j<W;j++){ | ^ a.cc:14:18: error: structured binding declaration cannot have type 'A' 14 | A[i,j] = (inp[j]=='#')?1:0; | ^~~~~ a.cc:14:18: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:14:21: error: redeclaration of 'auto j' 14 | A[i,j] = (inp[j]=='#')?1:0; | ^ a.cc:13:21: note: 'int j' previously declared here 13 | for(int j=0;j<W;j++){ | ^ a.cc:14:27: error: 'inp' was not declared in this scope; did you mean 'int'? 14 | A[i,j] = (inp[j]=='#')?1:0; | ^~~ | int a.cc:14:31: error: use of 'j' before deduction of 'auto' 14 | A[i,j] = (inp[j]=='#')?1:0; | ^ a.cc:17:9: error: 'Func' was not declared in this scope 17 | Func<int, int, bool> f = null; | ^~~~ a.cc:17:14: error: expected primary-expression before 'int' 17 | Func<int, int, bool> f = null; | ^~~ a.cc:18:9: error: 'f' was not declared in this scope 18 | f = (x, y) =>{ | ^ a.cc:18:14: error: 'x' was not declared in this scope 18 | f = (x, y) =>{ | ^ a.cc:18:17: error: 'y' was not declared in this scope 18 | f = (x, y) =>{ | ^ a.cc:18:21: error: expected primary-expression before '>' token 18 | f = (x, y) =>{ | ^ a.cc:18:22: error: expected primary-expression before '{' token 18 | f = (x, y) =>{ | ^ a.cc:31:13: error: 'Console' was not declared in this scope 31 | Console.WriteLine("Possible"); | ^~~~~~~ a.cc:33:13: error: 'Console' was not declared in this scope 33 | Console.WriteLine("Impossible"); | ^~~~~~~ a.cc: At global scope: a.cc:41:22: error: 'string' has not been declared 41 | static void Main(string[] args){ | ^~~~~~ a.cc:41:31: error: expected ',' or '...' before 'args' 41 | static void Main(string[] args){ | ^~~~ a.cc:45:2: error: expected ';' after class definition 45 | } | ^ | ; a.cc: In static member function 'static void Program::Main(int*)': a.cc:42:15: error: conversion from 'A*' to non-scalar type 'A' requested 42 | A a = new A(); | ^~~~~~~
s967494145
p03937
C++
#include <string> #include <queue> #include <stack> #include <vector> #include <sstream> #include <algorithm> #include <deque> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <list> #include <cstdio> #include <iostream> #include <cmath> #include <climits> #include <bitset> #include <functional> #include <numeric> #include <ctime> #include <cassert> #include <cstring> #include <fstream> #define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++) #define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++) #define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--) using namespace std; int main() { int h, w; cin >> h >> w; vector<string> data(h+1); FOR(i, 0, h) { cin >> data[i]; data[i].push_back('.'); } data[h].resize(w + 1); FOR(i, 0, w+1) { data[h][i] = '.'; } if (data[0][0] == '.' || data[h - 1][w - 1] == '.') { cout << "Impossible" << endl; return 0; } int posy = 0, posx = 0; bool res = true; while (posx != w - 1 || posy != h - 1) { if (data[posy + 1][posx] == data[posy][posx + 1]) { res = false; break; } else if (data[posy + 1][posx] == '#') { posy++; } else posx++; } assert(res == "Possible"); cout << (res ? "Possible" : "Impossible") << endl; return 0; }
In file included from /usr/include/c++/14/cassert:44, from a.cc:21: a.cc: In function 'int main()': a.cc:60:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 60 | assert(res == "Possible"); | ~~~~^~~~~~~~~~~~~
s861142176
p03937
C++
#include <iostream> #include <string> using namespace std; int main(){ int h,w; cin>>h>>w; vector<string> s(h); for(int i=0;i<h;i++)cin>>s[i]; int cnt=0; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ if(s[i][j]=='#')cnt++; } } if(cnt==h+w)cout<<"Possible"<<endl; else cout<<"Impossible"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:7:2: error: 'vector' was not declared in this scope 7 | vector<string> s(h); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include <iostream> +++ |+#include <vector> 2 | #include <string> a.cc:7:15: error: expected primary-expression before '>' token 7 | vector<string> s(h); | ^ a.cc:7:17: error: 's' was not declared in this scope 7 | vector<string> s(h); | ^
s749087009
p03937
C++
#include <utility> #include <map> #include <array> #include <functional> #include <cstdio> #include <vector> #include <iterator> template<typename T> struct ScanfSpecifier{}; #define DEF(T,V) template<> struct ScanfSpecifier<T>{static constexpr const char* value = V;}; DEF(char*,"%s")DEF(int,"%d")DEF(double,"%lf")DEF(float,"%f")DEF(char,"%c")DEF(const char*,"%s")DEF(unsigned long,"%lu")DEF(unsigned int, "%u") #ifdef _MSC_VER DEF(long long int,"%I64d") #else DEF(long long int,"%lld") #endif #undef DEF template<typename T> int RD(T& arg){return std::scanf(ScanfSpecifier<T>::value, &arg);} template<int S> int RD(char (&arg)[S]){return std::scanf("%s", arg);} int RD(char* arg){return std::scanf("%s", arg);} template<> int RD<char>(char& arg){return std::scanf(" %c", &arg);} template<typename T, typename... Args> int RD(T& arg1, Args&... args) {return RD(arg1) + RD(args...);} template<typename T> T RD(){T ret; RD(ret); return ret;} template<typename It> void RDV(It begin, It end) { while(begin != end) RD(*begin++); } template<typename C> void RDV(C& c) {RDV(std::begin(c), std::end(c));} template<typename T> void WT(T arg) {std::printf(ScanfSpecifier<T>::value, arg); } template<typename T, typename U> void WT(std::pair<T, U> arg) {std::printf("("); WT(arg.first); std::printf(", "); WT(arg.second); std::printf(")");} template<typename... Args> void WT(Args... args) { int alc = 0; int dummy[] = {((alc++? std::printf(" "): 0), WT(args), 0)...}; } template<typename... Args> void WTL(Args... args) { WT(args...); std::printf("\n"); } template<typename It> void WTV(It begin, It end) { int alc = 0; while(begin != end) (alc++? std::printf(" "): 0), WT(*begin++); } template<typename C> void WTV(const C& c) {WTV(std::begin(c), std::end(c));} template<typename It> void WTVL(It begin, It end) { WTV(begin, end); std::printf("\n"); } template<typename C> void WTVL(const C& c) {WTVL(std::begin(c), std::end(c));} namespace XX { template<template<typename> class Compare, typename T> inline T& UP(T& x, const T& y){if(Compare<T>()(y, x)) x = y; return x;} template<typename Compare, typename T> inline T& UP(T& x, const T& y, Compare comp){if(comp(y, x)) x = y; return x;} template<typename T> inline T& GT(T& x, const T& y){return UP<std::greater>(x, y);} template<typename T> inline T& LS(T& x, const T& y){return UP<std::less>(x, y);} template<typename T> struct Mapper { int operator[](const T& v) { int& ret = table[v]; if(!ret) rtable[ret = table.size()] = v; return ret - 1; } template<typename... Args> int operator()(Args... args) { return (*this)[T(args...)]; } T rev(int idx){return rtable[idx + 1];} std::map<T, int> table; std::map<int, T> rtable; }; template<typename T, int S> struct ReferenceArray { struct It {typename std::array<T*, S>::iterator it; T& operator*(){return **it;} void operator++(){it++;} bool operator!=(const It& other){return it != other.it;} }; int size()const{return _ptr.size();} It begin()const{return {_ptr.begin()};} It end()const{return {_ptr.end()};} T& operator[](int idx)const{return *_ptr[idx];} mutable std::array<T*, S> _ptr; }; template<typename T, typename... Args> ReferenceArray<T, sizeof...(Args) + 1> MAKEV(T& arg1, Args&... args) {return {&arg1, &args...};} struct Range { struct It { int num, step; int operator*(){return num;} void operator++(){num += step;} bool operator!=(const It& other){return num != other.num;} }; Range(int ee):b(0),e(ee){} Range(int bb, int ee):b(bb), e(ee){} It begin(){return {b, (b < e? 1: -1)};} It end(){return {e, 0};} int b, e; }; } //alias //RD[L],RDV[L],WT[L],WTV[L] for i/o template<typename T> T& UMAX(T& x, T y){return XX::UP<std::greater>(x, y);} template<typename T> T& UMIN(T& x, T y){return XX::UP<std::less>(x, y);} using XX::UP; //(x,y) comp using RG = XX::Range; using XX::MAKEV; using XX::Mapper; //template #include <vector> #include <string> #include <set> #include <map> #include <cstdlib> #include <algorithm> #include <functional> using namespace std; char grid[123][456]; int main() { memset(grid, '.', sizeof(grid)); int H, W; RD(H, W); for(int i: RG(H)) RDV(grid[i], grid[i] + W); bool ans = true; int x = 0, y = 0; while(!(x == H - 1 && y == W - 1)) { if(grid[x + 1][y] == '.') y++; else if(grid[x][y + 1] == '.') x++; else { ans = false; break; } } WTL(ans? "Possible": "Impossible"); }
a.cc: In function 'int main()': a.cc:108:5: error: 'memset' was not declared in this scope 108 | memset(grid, '.', sizeof(grid)); | ^~~~~~ a.cc:101:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 100 | #include <algorithm> +++ |+#include <cstring> 101 | #include <functional>
s543744222
p03937
C++
4 5 ##... .##.. ..##. ...##
a.cc:2:1: error: stray '##' in program 2 | ##... | ^~ a.cc:3:2: error: stray '##' in program 3 | .##.. | ^~ a.cc:4:3: error: stray '##' in program 4 | ..##. | ^~ a.cc:5:4: error: stray '##' in program 5 | ...## | ^~ a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 4 5 | ^
s346164614
p03937
C++
#include <bits/stdc++.h> using namespace std; #define FORE(i, a) for (auto i = a.begin(); i != a.end(); ++i) #define REPU(i, a, b) for (int i = (a); i < (b); ++i) #define REPD(i, a, b) for (int i = (a); i > (b); --i) #define MEM(a, x) memset(a, x, sizeof(a)) #define ALL(a) a.begin(), a.end() #define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) vector<string> split(const string &s, char c) { vector<string> v; stringstream ss(s); string x; while (getline(ss, x, c)) v.push_back(x); return v; } #define DEBUG(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); } void err(vector<string>::iterator it) {} template<typename T, typename... Args> void err(vector<string>::iterator it, T a, Args... args) { cerr << "[DEBUG] " << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n'; err(++it, args...); } typedef long long ll; const int MOD = 1000000007; template<class T, class U> inline T tmin(T a, U b) { return (a < b) ? a : b; } template<class T, class U> inline T tmax(T a, U b) { return (a > b) ? a : b; } template<class T, class U> inline void amax(T &a, U b) { if (b > a) a = b; } template<class T, class U> inline void amin(T &a, U b) { if (b < a) a = b; } template<class T> inline T tabs(T a) { return (a > 0) ? a : -a; } template<class T> T gcd(T a, T b) { while (b != 0) { T c = a; a = b; b = c % b; } return a; } int main(int argc, char *argv[]) { ios_base::sync_with_stdio(false); int w, h; cin >> w >> h; vector<vector<char>> a(w, vector<char>(h)); REPU(i, 0, w) REPU(j, 0, h) cin >> w[i][j]; REPU(i, 1, w) { int last = -1; REPU(j, 0, w) if (a[i - 1][j] == '#') { last = j; } REPU(j, 0, last) if (a[i][j] == '#') { puts("Impossible"); return 0; } } puts("Possible"); return 0; }
a.cc: In function 'int main(int, char**)': a.cc:45:45: error: invalid types 'int[int]' for array subscript 45 | REPU(i, 0, w) REPU(j, 0, h) cin >> w[i][j]; | ^
s040184357
p03938
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; #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 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>>; const double pi=acos(-1); template<int MOD> struct Fp { long long val; constexpr Fp(long long v = 0) noexcept : val(v % MOD) { if (val < 0) val += MOD; } constexpr int getmod() { return MOD; } constexpr Fp operator - () const noexcept { return val ? MOD - val : 0; } constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; } constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; } constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; } constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; } constexpr Fp& operator += (const Fp& r) noexcept { val += r.val; if (val >= MOD) val -= MOD; return *this; } constexpr Fp& operator -= (const Fp& r) noexcept { val -= r.val; if (val < 0) val += MOD; return *this; } constexpr Fp& operator *= (const Fp& r) noexcept { val = val * r.val % MOD; return *this; } constexpr Fp& operator /= (const Fp& r) noexcept { long long a = r.val, b = MOD, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } val = val * u % MOD; if (val < 0) val += MOD; return *this; } constexpr bool operator == (const Fp& r) const noexcept { return this->val == r.val; } constexpr bool operator != (const Fp& r) const noexcept { return this->val != r.val; } friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept { return os << x.val; } friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept { if (n == 0) return 1; auto t = modpow(a, n / 2); t = t * t; if (n & 1) t = t * a; return t; } }; using mint = Fp<MOD>; vector<bool> seen,finished; int pos = -1; int ca=0; int f=0; void dfs(const Graph &G, int v, int p) { seen[v] = true; for (auto nv : G[v]) { if (nv == p) continue; if (finished[nv]) continue; if (seen[nv] && !finished[nv]) { pos = nv;f++; return; } dfs(G, nv, v); // サイクル検出したならば真っ直ぐに抜けていく if (pos != -1) { return;}} finished[v] = true; } mint calc(long long N, long long K) { mint res = 1; for (long long n = 0; n < K; ++n) { res *= (N - n); res /= (n + 1); } return res; } struct UnionFind { vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(ll N) : par(N) { //最初は全てが根であるとして初期化 for(ll i = 0; i < N; i++) par[i] = i; } ll root(ll x) { // データxが属する木の根を再帰で得る:root(x) = {xの木の根} if (par[x] == x) return x; return par[x] = root(par[x]); } void unite(ll x, ll y) { // xとyの木を併合 ll rx = root(x); //xの根をrx ll ry = root(y); //yの根をry if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時:xの根rxをyの根ryにつける } bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す ll rx = root(x); ll ry = root(y); return rx == ry; } }; int main(){ ll n; cin>>n; ll p[n]={}; rep(i,n) cin>>p[i]; ll a[n]={}; ll b[n]={}; ll x=1,y=500000000; rep(i,n){ x+=p[i]; y-=1+p[i]; a[i]=x; b[i]=y;} rep(i,n)cout << a[i] << << " " << endl; rep(i,n)cout << b[i] << << " " << endl;}
a.cc: In function 'int main()': a.cc:145:25: error: expected primary-expression before '<<' token 145 | rep(i,n)cout << a[i] << << " " << endl; | ^~ a.cc:146:25: error: expected primary-expression before '<<' token 146 | rep(i,n)cout << b[i] << << " " << endl;} | ^~
s767993043
p03938
C++
#include <bits/stdc++.h> #define INF 2000000000000000000 #define ll long long #define pll pair<ll, ll> using namespace std; bool debug = true; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N; cin >> N; vector<ll> temp_P(N); for (ll i = 0; i < N; ++i) { cin >> temp_P.at(i); } vector<ll> P(N); for (ll i = 0; i < N; ++i) { P.at(temp_P) = i + 1; } vector<ll> a(N, 0), b(N, 0); for (ll i = 0; i < N; ++i) { a.at(i) = i + 1; b.at(N - i - 1) = i + 1; } for (ll i = 0; i < N; ++i) { ll p = P.at(i); for (ll j = i; j < N; ++j) { a.at(j) += p; } for (ll j = 0; j <= i; ++j) { b.at(j) += p; } } for (ll i = 0; i < N; ++i) { cout << a.at(i) << " "; } cout << "\n"; for (ll i = 0; i < N; ++i) { cout << b.at(i) << " "; } cout << "\n"; }
a.cc: In function 'int main()': a.cc:19:9: error: no matching function for call to 'std::vector<long long int>::at(std::vector<long long int>&)' 19 | P.at(temp_P) = i + 1; | ~~~~^~~~~~~~ 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:1180:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::at(size_type) [with _Tp = long long int; _Alloc = std::allocator<long long int>; reference = long long int&; size_type = long unsigned int]' 1180 | at(size_type __n) | ^~ /usr/include/c++/14/bits/stl_vector.h:1180:20: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<long long int>::size_type' {aka 'long unsigned int'} 1180 | at(size_type __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1199:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::at(size_type) const [with _Tp = long long int; _Alloc = std::allocator<long long int>; const_reference = const long long int&; size_type = long unsigned int]' 1199 | at(size_type __n) const | ^~ /usr/include/c++/14/bits/stl_vector.h:1199:20: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<long long int>::size_type' {aka 'long unsigned int'} 1199 | at(size_type __n) const | ~~~~~~~~~~^~~
s923631726
p03938
C++
n = int(input()) p = list(map(int, input().split())) a = list(range(20000, (n + 1) * 20000, 20000)) b = a[::-1] for i in range(len(p)): a[p[i] - 1] -= n - i for i in a: print(i, end=" ") print() for i in b: print(i, end=" ") print()
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^
s505362764
p03938
C++
#include<iostream> #include<bits/stdc++.h> using namespace std; int main() { long long i, j=0, k, n, m, p=0; cin >> n; for(i=0; i<n; i++) { cin >> arr[i]; } sort(arr, arr+n); for(i=0; i<n; i++) { cout << arr[i] << " "; } cout << endl; for(i=n-1; i>=0; i--) { cout << arr[i]-1; << " "; } }
a.cc: In function 'int main()': a.cc:10:16: error: 'arr' was not declared in this scope 10 | cin >> arr[i]; | ^~~ a.cc:12:10: error: 'arr' was not declared in this scope 12 | sort(arr, arr+n); | ^~~ a.cc:20:27: error: expected primary-expression before '<<' token 20 | cout << arr[i]-1; << " "; | ^~
s485459078
p03938
C++
#include <bits/stdc++.h> using namespace std; #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL) #define ll long long #define inf 1e18 #define pi acos(-1.0) #define mod 998244353 ll n,k,a[20005],b[20005],p[20005],i,j,index,m; int main(void) { fastio; cin >> n; for(i=0;i<n;i++)cin >> p[i]; for(i=1;i<=n;i++)a[i]=i; for(i=1,j=n;i<=n;i++,j--)b[i]=j; m=a[p[0]]+b[p[0]]; index=p[0]; for(i=1;i<n;i++) { if(p[i]<index) { b[p[i]]=m+1-a[p[i]]; m++; } else { a[p[i]]=m+1-b[p[i]]; m++; } index=p[i]; } for(i=1;i<=n;i++)cout << a[i] << " "; cout << "\n"; for(i=1;i<=n;i++)cout << b[i] << " "; return 0; }
a.cc:10:39: error: 'long long int index' redeclared as different kind of entity 10 | ll n,k,a[20005],b[20005],p[20005],i,j,index,m; | ^~~~~ In file included from /usr/include/string.h:462, from /usr/include/c++/14/cstring:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121, from a.cc:1: /usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)' 50 | extern const char *index (const char *__s, int __c) | ^~~~~ a.cc: In function 'int main()': a.cc:22:14: error: overloaded function with no contextual type information 22 | index=p[0]; | ^ a.cc:25:16: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator<' 25 | if(p[i]<index) | ~~~~^~~~~~ a.cc:35:18: error: overloaded function with no contextual type information 35 | index=p[i]; | ^
s549459557
p03938
Java
import java.util.*; public class Main { static void solve() { int n = ni(); int[] a = new int[n], b = new int[n]; for(int i=0;i<n;i++) { a[i] = 30000 * i + 1; } for(int i=0;i<n;i++) { b[i] = n - i; } for(int i=0;i<n;i++) { int p = ni()-1; a[p] += i; } for(int i=0;i<n;i++) out.print(a[i] + " "); out.println(); for(int i=0;i<n;i++) out.print(b[i] + " "); } //constant static final int inf = Integer.MAX_VALUE / 2; static final long linf = Long.MAX_VALUE / 3; static final double dinf = Double.MAX_VALUE / 3; static final long mod = (long) 1e9 + 7; static final int[] dx = { -1, 0, 1, 0 }, dy = { 0, -1, 0, 1 }, dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 }; static final double eps = 1e-10, pi = Math.PI; static StringBuilder sb = new StringBuilder(); //libraries static void reverse(int ar[]) { int len = ar.length; for (int i = 0; i < len / 2; i++) { int t = ar[i]; ar[i] = ar[len - 1 - i]; ar[len - 1 - i] = t; } } static void reverse(long ar[]) { int len = ar.length; for (int i = 0; i < len / 2; i++) { long t = ar[i]; ar[i] = ar[len - 1 - i]; ar[len - 1 - i] = t; } } static void reverse(double ar[]) { int len = ar.length; for (int i = 0; i < len / 2; i++) { double t = ar[i]; ar[i] = ar[len - 1 - i]; ar[len - 1 - i] = t; } } static void reverse(char ar[]) { int len = ar.length; for (int i = 0; i < len / 2; i++) { char t = ar[i]; ar[i] = ar[len - 1 - i]; ar[len - 1 - i] = t; } } static String getReverse(String s) { char c[] = s.toCharArray(); reverse(c); s = String.valueOf(c); return s; } static <T> void reverse(List<T> ls) { int sz = ls.size(); for (int i = 0; i < sz / 2; i++) { T t = ls.get(i); ls.set(i, ls.get(sz - 1 - i)); ls.set(sz - 1 - i, t); } } static <T> void reverse(T[] ar) { int len = ar.length; for (int i = 0; i < len / 2; i++) { T t = ar[i]; ar[i] = ar[len - 1 - i]; ar[len - 1 - i] = t; } } static void sbnl() {//StringBuilderに改行文字をappendする sb.append("\n"); } static int lowerBound(int[] a, int x) { int l = -1, r = a.length; while (r - l > 1) { int c = (l + r) / 2; if (a[c] < x) { l = c; } else { r = c; } } return r; } static int upperBound(int[] a, int x) { int l = -1, r = a.length; while (r - l > 1) { int c = (l + r) / 2; if (a[c] <= x) { l = c; } else { r = c; } } return r; } static int rlowerBound(int[] a, int x) { int l = -1, r = a.length; while (r - l > 1) { int c = (l + r) / 2; if (a[c] > x) { l = c; } else { r = c; } } return r; } static int rupperBound(int[] a, int x) { int l = -1, r = a.length; while (r - l > 1) { int c = (l + r) / 2; if (a[c] >= x) { l = c; } else { r = c; } } return r; } static int lowerBound(long[] a, long x) { int l = -1, r = a.length; while (r - l > 1) { int c = (l + r) / 2; if (a[c] < x) { l = c; } else { r = c; } } return r; } static int upperBound(long[] a, long x) { int l = -1, r = a.length; while (r - l > 1) { int c = (l + r) / 2; if (a[c] <= x) { l = c; } else { r = c; } } return r; } static int rlowerBound(long[] a, long x) { int l = -1, r = a.length; while (r - l > 1) { int c = (l + r) / 2; if (a[c] > x) { l = c; } else { r = c; } } return r; } static int rupperBound(long[] a, long x) { int l = -1, r = a.length; while (r - l > 1) { int c = (l + r) / 2; if (a[c] >= x) { l = c; } else { r = c; } } return r; } static int lowerBound(double[] a, double x) { int l = -1, r = a.length; while (r - l > 1) { int c = (l + r) / 2; if (a[c] < x) { l = c; } else { r = c; } } return r; } static int upperBound(double[] a, double x) { int l = -1, r = a.length; while (r - l > 1) { int c = (l + r) / 2; if (a[c] <= x) { l = c; } else { r = c; } } return r; } static int rlowerBound(double[] a, double x) { int l = -1, r = a.length; while (r - l > 1) { int c = (l + r) / 2; if (a[c] > x) { l = c; } else { r = c; } } return r; } static int rupperBound(double[] a, double x) { int l = -1, r = a.length; while (r - l > 1) { int c = (l + r) / 2; if (a[c] >= x) { l = c; } else { r = c; } } return r; } static int lowerBound(char[] a, char x) { int l = -1, r = a.length; while (r - l > 1) { int c = (l + r) / 2; if (a[c] < x) { l = c; } else { r = c; } } return r; } static int upperBound(char[] a, char x) { int l = -1, r = a.length; while (r - l > 1) { int c = (l + r) / 2; if (a[c] <= x) { l = c; } else { r = c; } } return r; } static int rlowerBound(char[] a, char x) { int l = -1, r = a.length; while (r - l > 1) { int c = (l + r) / 2; if (a[c] > x) { l = c; } else { r = c; } } return r; } static int rupperBound(char[] a, char x) { int l = -1, r = a.length; while (r - l > 1) { int c = (l + r) / 2; if (a[c] >= x) { l = c; } else { r = c; } } return r; } static <T> int lowerBound(List<T> ls, T x) throws RuntimeException { if (ls.size() == 0) return -1; if (ls.get(0) instanceof Integer) { return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) >= 0 ? 1 : -1); } else if (ls.get(0) instanceof Long) { return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) >= 0 ? 1 : -1); } else if (ls.get(0) instanceof Double) { return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) >= 0 ? 1 : -1); } else { System.err.println( String.format("%s:数値でないリストを二分探索しています。", Thread.currentThread().getStackTrace()[1].getMethodName())); throw new RuntimeException(); } } static <T> int upperBound(List<T> ls, T x) throws RuntimeException { if (ls.size() == 0) return -1; if (ls.get(0) instanceof Integer) { return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) > 0 ? 1 : -1); } else if (ls.get(0) instanceof Long) { return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) > 0 ? 1 : -1); } else if (ls.get(0) instanceof Double) { return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) > 0 ? 1 : -1); } else { System.err.println( String.format("%s:数値でないリストを二分探索しています。", Thread.currentThread().getStackTrace()[1].getMethodName())); throw new RuntimeException(); } } static <T> int rupperBound(List<T> ls, T x) throws RuntimeException { if (ls.size() == 0) return -1; if (ls.get(0) instanceof Integer) { return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) < 0 ? 1 : -1); } else if (ls.get(0) instanceof Long) { return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) < 0 ? 1 : -1); } else if (ls.get(0) instanceof Double) { return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) < 0 ? 1 : -1); } else { System.err.println( String.format("%s:数値でないリストを二分探索しています。", Thread.currentThread().getStackTrace()[1].getMethodName())); throw new RuntimeException(); } } static <T> int rlowerBound(List<T> ls, T x) { if (ls.size() == 0) return -1; if (ls.get(0) instanceof Integer) { return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) <= 0 ? 1 : -1); } else if (ls.get(0) instanceof Long) { return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) <= 0 ? 1 : -1); } else if (ls.get(0) instanceof Double) { return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) <= 0 ? 1 : -1); } else { System.err.println( String.format("%s:数値でないリストを二分探索しています。", Thread.currentThread().getStackTrace()[1].getMethodName())); throw new RuntimeException(); } } static int[] concat(int x, int arr[]) { int ret[] = new int[arr.length + 1]; System.arraycopy(arr, 0, ret, 1, ret.length - 1); ret[0] = x; return ret; } static int[] concat(int arr[], int x) { int ret[] = new int[arr.length + 1]; System.arraycopy(arr, 0, ret, 0, ret.length - 1); ret[ret.length - 1] = x; return ret; } static long[] concat(long x, long arr[]) { long ret[] = new long[arr.length + 1]; System.arraycopy(arr, 0, ret, 1, ret.length - 1); ret[0] = x; return ret; } static long[] concat(long arr[], long x) { long ret[] = new long[arr.length + 1]; System.arraycopy(arr, 0, ret, 0, ret.length - 1); ret[ret.length - 1] = x; return ret; } static char[] concat(char x, char arr[]) { char ret[] = new char[arr.length + 1]; System.arraycopy(arr, 0, ret, 0, ret.length - 1); ret[ret.length - 1] = x; return ret; } static char[] concat(char arr[], char x) { char ret[] = new char[arr.length + 1]; System.arraycopy(arr, 0, ret, 0, ret.length - 1); ret[ret.length - 1] = x; return ret; } static int max(int x, int y) { return Math.max(x, y); } static int min(int x, int y) { return Math.min(x, y); } static int max(int x, int y, int z) { x = Math.max(x, y); x = Math.max(x, z); return x; } static int min(int x, int y, int z) { x = Math.min(x, y); x = Math.min(x, z); return x; } static long max(long x, long y) { return Math.max(x, y); } static long min(long x, long y) { return Math.min(x, y); } static long max(long x, long y, long z) { x = Math.max(x, y); x = Math.max(x, z); return x; } static long min(long x, long y, long z) { x = Math.min(x, y); x = Math.min(x, z); return x; } static double max(double x, double y) { return Math.max(x, y); } static double min(double x, double y) { return Math.min(x, y); } static double max(double x, double y, double z) { x = Math.max(x, y); x = Math.max(x, z); return x; } static double min(double x, double y, double z) { x = Math.min(x, y); x = Math.min(x, z); return x; } static void sort(int[] ar) { Arrays.sort(ar); } static void sort(long[] ar) { Arrays.sort(ar); } static void sort(double[] ar) { Arrays.sort(ar); } static void sort(char[] ar) { Arrays.sort(ar); } static void rsort(int[] ar) { Arrays.sort(ar); int len = ar.length; for (int i = 0; i < len / 2; i++) { int tmp = ar[i]; ar[i] = ar[len - 1 - i]; ar[len - 1 - i] = tmp; } } static void rsort(long[] ar) { Arrays.sort(ar); int len = ar.length; for (int i = 0; i < len / 2; i++) { long tmp = ar[i]; ar[i] = ar[len - 1 - i]; ar[len - 1 - i] = tmp; } } static void rsort(double[] ar) { Arrays.sort(ar); int len = ar.length; for (int i = 0; i < len / 2; i++) { double tmp = ar[i]; ar[i] = ar[len - 1 - i]; ar[len - 1 - i] = tmp; } } static void rsort(char[] ar) { Arrays.sort(ar); int len = ar.length; for (int i = 0; i < len / 2; i++) { char tmp = ar[i]; ar[i] = ar[len - 1 - i]; ar[len - 1 - i] = tmp; } } static void fill(int arr[], int x) { Arrays.fill(arr, x); } static void fill(long arr[], long x) { Arrays.fill(arr, x); } static void fill(boolean arr[], boolean x) { Arrays.fill(arr, x); } static void fill(double arr[], double x) { Arrays.fill(arr, x); } static void fill(int arr[][], int x) { for (int i = 0; i < arr.length; i++) Arrays.fill(arr[i], x); } static void fill(long arr[][], long x) { for (int i = 0; i < arr.length; i++) Arrays.fill(arr[i], x); } static void fill(double arr[][], double x) { for (int i = 0; i < arr.length; i++) Arrays.fill(arr[i], x); } static void fill(boolean arr[][], boolean x) { for (int i = 0; i < arr.length; i++) Arrays.fill(arr[i], x); } //MOD culc static long plus(long x, long y) { long res = (x + y) % mod; return res < 0 ? res + mod : res; } static long sub(long x, long y) { long res = (x - y) % mod; return res < 0 ? res + mod : res; } static long mul(long x, long y) { long res = (x * y) % mod; return res < 0 ? res + mod : res; } static long div(long x, long y) { long res = x * pow(y, mod - 2) % mod; return res < 0 ? res + mod : res; } static long pow(long x, long y) { if (y < 0) return 0; if (y == 0) return 1; if (y % 2 == 1) return (x * pow(x, y - 1)) % mod; long root = pow(x, y / 2); return root * root % mod; } public static void main(String[] args) throws Exception { is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); out = new PrintWriter(System.out); solve(); out.flush(); } //input static InputStream is; static PrintWriter out; static String INPUT = ""; private static byte[] inbuf = new byte[1024]; static int lenbuf = 0, ptrbuf = 0; private static int readByte() { if (lenbuf == -1) throw new InputMismatchException(); if (ptrbuf >= lenbuf) { ptrbuf = 0; try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); } if (lenbuf <= 0) return -1; } return inbuf[ptrbuf++]; } private static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private static int skip() { int b; while ((b = readByte()) != -1 && isSpaceChar(b)) ; return b; } @SuppressWarnings("unused") private static double nd() { return Double.parseDouble(ns()); } @SuppressWarnings("unused") private static char nc() { return (char) skip(); } private static String ns() { int b = skip(); StringBuilder sb = new StringBuilder(); while (!(isSpaceChar(b))) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } private static char[] ns(int n) { char[] buf = new char[n]; int b = skip(), p = 0; while (p < n && !(isSpaceChar(b))) { buf[p++] = (char) b; b = readByte(); } return n == p ? buf : Arrays.copyOf(buf, p); } @SuppressWarnings("unused") private static char[][] nm(int n, int m) { char[][] map = new char[n][]; for (int i = 0; i < n; i++) map[i] = ns(m); return map; } @SuppressWarnings("unused") private static int[] na(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = ni(); return a; } @SuppressWarnings("unused") private static long[] nla(int n) { long[] a = new long[n]; for (int i = 0; i < n; i++) a[i] = nl(); return a; } @SuppressWarnings("unused") private static int[][] nas(int n, int m){ int[][] res = new int[n][m]; for(int i=0;i<n;i++) { for(int j=0;j<m;j++) { res[i][j] = ni(); } } return res; } @SuppressWarnings("unused") private static long[][] nlas(int n, int m){ long[][] res = new long[n][m]; for(int i=0;i<n;i++) { for(int j=0;j<m;j++) { res[i][j] = nl(); } } return res; } @SuppressWarnings("unused") private static int ni() { int num = 0, b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } @SuppressWarnings("unused") private static long nl() { long num = 0; int b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } }
Main.java:536: error: cannot find symbol static InputStream is; ^ symbol: class InputStream location: class Main Main.java:537: error: cannot find symbol static PrintWriter out; ^ symbol: class PrintWriter location: class Main Main.java:530: error: cannot find symbol is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); ^ symbol: class ByteArrayInputStream location: class Main Main.java:531: error: cannot find symbol out = new PrintWriter(System.out); ^ symbol: class PrintWriter location: class Main Main.java:548: error: cannot find symbol } catch (IOException e) { ^ symbol: class IOException location: class Main 5 errors
s163333574
p03938
C++
#pragma GCC optimize(2) #include<bits/stdc++.h> #define ll long long #define maxn 1000005 #define inf 1e9 #define pb push_back #define rep(i,a,b) for(int i=a;i<=b;i++) #define per(i,a,b) for(int i=a;i>=b;i--) using namespace std; inline int read() { int x=0,w=1; char c=getchar(); while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();} while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();} return w==1?x:-x; } ll a[maxn],b[maxn],p[maxn],n; int main() n=read(); rep(i,1,n) p[i]=read(); rep(i,1,n) a[i]=i*1000000,b[i]=(n-i+1)*1000000; rep(i,1,n) a[p[i]]+=i; rep(i,1,n) printf("%lld ",a[i]); puts(""); rep(i,1,n) printf("%lld ",b[i]); puts(""); return 0; }
a.cc:22:9: error: expected initializer before 'n' 22 | n=read(); rep(i,1,n) p[i]=read(); | ^ a.cc:7:20: error: expected unqualified-id before 'for' 7 | #define rep(i,a,b) for(int i=a;i<=b;i++) | ^~~ a.cc:22:19: note: in expansion of macro 'rep' 22 | n=read(); rep(i,1,n) p[i]=read(); | ^~~ a.cc:22:23: error: 'i' does not name a type 22 | n=read(); rep(i,1,n) p[i]=read(); | ^ a.cc:7:32: note: in definition of macro 'rep' 7 | #define rep(i,a,b) for(int i=a;i<=b;i++) | ^ a.cc:22:23: error: 'i' does not name a type 22 | n=read(); rep(i,1,n) p[i]=read(); | ^ a.cc:7:37: note: in definition of macro 'rep' 7 | #define rep(i,a,b) for(int i=a;i<=b;i++) | ^ a.cc:7:20: error: expected unqualified-id before 'for' 7 | #define rep(i,a,b) for(int i=a;i<=b;i++) | ^~~ a.cc:23:9: note: in expansion of macro 'rep' 23 | rep(i,1,n) a[i]=i*1000000,b[i]=(n-i+1)*1000000; | ^~~ a.cc:23:13: error: 'i' does not name a type 23 | rep(i,1,n) a[i]=i*1000000,b[i]=(n-i+1)*1000000; | ^ a.cc:7:32: note: in definition of macro 'rep' 7 | #define rep(i,a,b) for(int i=a;i<=b;i++) | ^ a.cc:23:13: error: 'i' does not name a type 23 | rep(i,1,n) a[i]=i*1000000,b[i]=(n-i+1)*1000000; | ^ a.cc:7:37: note: in definition of macro 'rep' 7 | #define rep(i,a,b) for(int i=a;i<=b;i++) | ^ a.cc:7:20: error: expected unqualified-id before 'for' 7 | #define rep(i,a,b) for(int i=a;i<=b;i++) | ^~~ a.cc:24:9: note: in expansion of macro 'rep' 24 | rep(i,1,n) a[p[i]]+=i; | ^~~ a.cc:24:13: error: 'i' does not name a type 24 | rep(i,1,n) a[p[i]]+=i; | ^ a.cc:7:32: note: in definition of macro 'rep' 7 | #define rep(i,a,b) for(int i=a;i<=b;i++) | ^ a.cc:24:13: error: 'i' does not name a type 24 | rep(i,1,n) a[p[i]]+=i; | ^ a.cc:7:37: note: in definition of macro 'rep' 7 | #define rep(i,a,b) for(int i=a;i<=b;i++) | ^ a.cc:7:20: error: expected unqualified-id before 'for' 7 | #define rep(i,a,b) for(int i=a;i<=b;i++) | ^~~ a.cc:25:9: note: in expansion of macro 'rep' 25 | rep(i,1,n) printf("%lld ",a[i]); puts(""); | ^~~ a.cc:25:13: error: 'i' does not name a type 25 | rep(i,1,n) printf("%lld ",a[i]); puts(""); | ^ a.cc:7:32: note: in definition of macro 'rep' 7 | #define rep(i,a,b) for(int i=a;i<=b;i++) | ^ a.cc:25:13: error: 'i' does not name a type 25 | rep(i,1,n) printf("%lld ",a[i]); puts(""); | ^ a.cc:7:37: note: in definition of macro 'rep' 7 | #define rep(i,a,b) for(int i=a;i<=b;i++) | ^ a.cc:25:46: error: expected constructor, destructor, or type conversion before '(' token 25 | rep(i,1,n) printf("%lld ",a[i]); puts(""); | ^ a.cc:7:20: error: expected unqualified-id before 'for' 7 | #define rep(i,a,b) for(int i=a;i<=b;i++) | ^~~ a.cc:26:9: note: in expansion of macro 'rep' 26 | rep(i,1,n) printf("%lld ",b[i]); puts(""); | ^~~ a.cc:26:13: error: 'i' does not name a type 26 | rep(i,1,n) printf("%lld ",b[i]); puts(""); | ^ a.cc:7:32: note: in definition of macro 'rep' 7 | #define rep(i,a,b) for(int i=a;i<=b;i++) | ^ a.cc:26:13: error: 'i' does not name a type 26 | rep(i,1,n) printf("%lld ",b[i]); puts(""); | ^ a.cc:7:37: note: in definition of macro 'rep' 7 | #define rep(i,a,b) for(int i=a;i<=b;i++) | ^ a.cc:26:46: error: expected constructor, destructor, or type conversion before '(' token 26 | rep(i,1,n) printf("%lld ",b[i]); puts(""); | ^ a.cc:27:9: error: expected unqualified-id before 'return' 27 | return 0; | ^~~~~~ a.cc:28:1: error: expected declaration before '}' token 28 | } | ^
s023104026
p03938
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define repr(i, n) for (int i = (n); i >= 0; --i) #define FOR(i, m, n) for (int i = (m); i < (n); ++i) #define FORR(i, m, n) for (int i = (m); i >= (n); --i) #define equals(a, b) (fabs((a) - (b)) < EPS) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; const ll mod = 1000000007; //const ll mod = 998244353; const int inf = 1e9 + 10; const ll INF = 1e18; const ld EPS = 1e-10; const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(25); int n; cin >> n; vector<int> p(n); rep(i, n) { cin >> p[i]; p[i]--; } vector<int> a(n), b(n); rep(i, n) a[i] = i + 1; rep(i, n) b[n - 1 - i] = i + 1; rep(i, n) { used[p[i]] = true; FOR(j, p[i] + 1, n) { if (!used[j]) a[j]++; } repr(j, p[i] - 1) { if (!used[j]) b[j]++; } } rep(i, n) cout << a[i] << (i == n - 1 ? '\n' : ' '); rep(i, n) cout << b[i] << (i == n - 1 ? '\n' : ' '); return 0; }
a.cc: In function 'int main()': a.cc:40:5: error: 'used' was not declared in this scope 40 | used[p[i]] = true; | ^~~~
s548337091
p03938
C++
///Bismillahir Rahmanir Rahim #include<bits/stdc++.h> #define int long long #define fi first #define si second #define mp make_pair #define pb push_back #define pi pair<int,int> #define f(i,l,r) for(int i=l;i<=r;i++) #define rf(i,r,l) for(int i=r;i>=l;i--) #define done(i) cout<<"done = "<<i<<endl; #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; const int inf=1e5; const int mod=1e9+7; const int M=20009; inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;} inline int ad(int x,int y){int ret=(x%mod+y%mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;} inline int sub(int x,int y){int ret=((x%mod)-(y%mod)+mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;} inline int gun(int x,int y){int ret=((x%mod)*(y%mod))%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;} int id[M+3]; int pup[M+4]; int pdown[M+4]; int a[M+4]; int b[M+4]; solve() { int n; cin>>n; f(i,1,n) { cin>>id[i]; } f(i,1,n) { a[i]+=i; } for(int i=n,j=1;i>=1;i--,j++) { b[i]+=j; } for(int i=1;i<=n;i++) { int idx=id[i]; b[idx]+=i; pdown[idx-1]+=i; pup[idx-1]-=i; } int yo=0; int cry=0; for(int i=n;i>=1;i--) { yo+=pdown[i]; b[i]+=yo; cry+=pup[i]; a[i]+=cry; } int mn=0; f(i,1,n) { mn=min(mn,a[i]); } f(i,1,n) { mn=min(mn,b[i]); } if(mn>0)mn=0; else mn=-mn+2; f(i,1,n) { cout<<a[i]+mn<<" "; } cout<<endl; f(i,1,n) { cout<<b[i]+mn<<" "; } cout<<endl; } main() { //freopen("001.txt", "r", stdin); int t; t=1; while(t--) { solve(); } return 0; }
a.cc:34:2: error: ISO C++ forbids declaration of 'solve' with no type [-fpermissive] 34 | solve() | ^~~~~ a.cc: In function 'int solve()': a.cc:90:1: warning: no return statement in function returning non-void [-Wreturn-type] 90 | } | ^ a.cc: At global scope: a.cc:91:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 91 | main() | ^~~~
s745396067
p03938
C++
~/workspace/atcoder master ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main 5 3 -30 -10 10 20 50 40 ~/workspace/atcoder master 8s ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main 3 2 10 20 30 20 ~/workspace/atcoder master ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main 1 1 0 0 ~/workspace/atcoder master ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main 8 5 -9 -7 -4 -3 1 2 3 4 10 ~/workspace/atcoder master ❯ act abc145 c Log in... Compile... Fetch testcases... Sample Input 1 : WA ans = 2.2761423749, wa = 0 Sample Input 2 : WA ans = 91.9238815543, wa = 91.9239 Sample Input 3 : WA ans = 7641.9817824387, wa = 0 ~/workspace/atcoder master ❯ act abc145 c Log in... Compile... Fetch testcases... Sample Input 1 : WA ans = 2.2761423749, wa = 2.27614 Sample Input 2 : WA ans = 91.9238815543, wa = 91.9239 Sample Input 3 : WA ans = 7641.9817824387, wa = 7641.98 ~/workspace/atcoder master ❯ act abc145 c Log in... Compile... Fetch testcases... Sample Input 1 : AC Sample Input 2 : AC Sample Input 3 : AC Submit...Complete! ~/workspace/atcoder master ❯ act abc148 f Log in... Compile... Fetch testcases... Sample Input 1 : AC Sample Input 2 : AC Sample Input 3 : AC Sample Input 4 : AC Submit...Complete! ~/workspace/atcoder master 6s ❯ act abc148 f Log in... Compile... Fetch testcases... Sample Input 1 : AC Sample Input 2 : AC Sample Input 3 : AC Sample Input 4 : AC Submit...Complete! ~/workspace/atcoder master 9s ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main 5 4 2 1 7 ~/workspace/atcoder master ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main 5 4 2 5 3 ~/workspace/atcoder master ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main 3 3 3 1 3 ~/workspace/atcoder master ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main 314159265 358979323 84 448759046 224379523 ~/workspace/atcoder master ❯ act abc066 b Log in... Compile... Fetch testcases... Sample Input 1 : WA ans = 6, wa = Sample Input 2 : WA ans = 2, wa = Sample Input 3 : WA ans = 6, wa = Sample Input 4 : RE terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 18446744073709551614) ~/workspace/atcoder master ❯ act abc066 b Log in... Compile... Fetch testcases... Sample Input 1 : WA ans = 6, wa = Sample Input 2 : WA ans = 2, wa = Sample Input 3 : WA ans = 6, wa = Sample Input 4 : RE terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 18446744073709551614) ~/workspace/atcoder master ❯ act abc066 b Log in... Compile... Fetch testcases... Sample Input 1 : WA ans = 6, wa = 0 Sample Input 2 : WA ans = 2, wa = 0 Sample Input 3 : WA ans = 6, wa = 0 Sample Input 4 : WA ans = 14, wa = 0 ~/workspace/atcoder master ❯ act abc066 b Log in... Compile... Fetch testcases... Sample Input 1 : AC Sample Input 2 : AC Sample Input 3 : AC Sample Input 4 : AC Submit...Complete! ~/workspace/atcoder master ❯ arc081 a zsh: command not found: arc081 ~/workspace/atcoder master ❯ act arc081 a Log in... Compile... Fetch testcases... Sample Input 1 : WA ans = 2, wa = 0 Sample Input 2 : AC Sample Input 3 : WA ans = 20, wa = 9 ~/workspace/atcoder master ❯ act arc081 a Log in... Compile... Fetch testcases... Sample Input 1 : WA ans = 2, wa = 0 Sample Input 2 : AC Sample Input 3 : WA ans = 20, wa = 15 ~/workspace/atcoder master ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main 6 3 1 2 4 2 1 1 2 2 2 3 1 4 1 0 ~/workspace/atcoder master ❯ act arc081 a Log in... Compile... Fetch testcases... Sample Input 1 : AC Sample Input 2 : AC Sample Input 3 : AC Submit...Complete! ~/workspace/atcoder master ❯ act abc076 c Log in... Compile... Fetch testcases... Sample Input 1 : WA ans = ?tc???? coder, wa = ~ Sample Input 2 : WA ans = ??p??d?? abc, wa = atcoder Sample Input 3 : WA ans = <var>S</var> <var>T'</var>, wa = UNRESTORABLE Sample Input 4 : WA ans = atcoder, wa = ~ Sample Input 5 : WA ans = UNRESTORABLE, wa = ~ ~/workspace/atcoder master ❯ act abc076 c Log in... Compile... Fetch testcases... Sample Input 1 : WA ans = ?tc???? coder, wa = UNRESTORABLE Sample Input 2 : WA ans = ??p??d?? abc, wa = atcoder Sample Input 3 : WA ans = <var>S</var> <var>T'</var>, wa = UNRESTORABLE Sample Input 4 : WA ans = atcoder, wa = UNRESTORABLE Sample Input 5 : AC ~/workspace/atcoder master ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main ?tc???? coder UNRESTORABLE ~/workspace/atcoder master 6s ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main ?tc???? coder atcoder ~/workspace/atcoder master ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main ??p??d?? abc UNRESTORABLE ~/workspace/atcoder master ❯ act arc097 c Log in... Compile... Fetch testcases... Sample Input 1 : WA ans = 4, wa = 1 Sample Input 2 : WA ans = 18, wa = 1 Sample Input 3 : WA ans = 41, wa = ~/workspace/atcoder master ❯ act arc097 c Log in... Compile... Fetch testcases... Sample Input 1 : WA ans = 4, wa = Sample Input 2 : WA ans = 18, wa = Sample Input 3 : WA ans = 41, wa = 1 ~/workspace/atcoder master ❯ act arc097 b Log in... Compile... Fetch testcases... Sample Input 1 : AC Sample Input 2 : AC Sample Input 3 : AC Sample Input 4 : AC Submit...Complete! ~/workspace/atcoder master ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main 2 1 2 20000 40000 799980000 799960001 ~/workspace/atcoder master 7s ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main 3 3 2 1 60000 40000 20000 799940002 799960001 799980000 ~/workspace/atcoder master 6s ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main 3 3 2 1 20000 40000 60000 799980002 799960001 799940000 ~/workspace/atcoder master ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main 3 2 3 1 20000 40000 60000 799980002 799960000 799940001 ~/workspace/atcoder master ❯
a.cc:3:1: error: extended character ❯ is not valid in an identifier 3 | ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main | ^ a.cc:9:1: error: extended character ❯ is not valid in an identifier 9 | ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main | ^ a.cc:15:1: error: extended character ❯ is not valid in an identifier 15 | ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main | ^ a.cc:21:1: error: extended character ❯ is not valid in an identifier 21 | ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main | ^ a.cc:27:1: error: extended character ❯ is not valid in an identifier 27 | ❯ act abc145 c | ^ a.cc:38:1: error: extended character ❯ is not valid in an identifier 38 | ❯ act abc145 c | ^ a.cc:49:1: error: extended character ❯ is not valid in an identifier 49 | ❯ act abc145 c | ^ a.cc:61:1: error: extended character ❯ is not valid in an identifier 61 | ❯ act abc148 f | ^ a.cc:74:1: error: extended character ❯ is not valid in an identifier 74 | ❯ act abc148 f | ^ a.cc:87:1: error: extended character ❯ is not valid in an identifier 87 | ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main | ^ a.cc:92:1: error: extended character ❯ is not valid in an identifier 92 | ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main | ^ a.cc:97:1: error: extended character ❯ is not valid in an identifier 97 | ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main | ^ a.cc:102:1: error: extended character ❯ is not valid in an identifier 102 | ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main | ^ a.cc:107:1: error: extended character ❯ is not valid in an identifier 107 | ❯ act abc066 b | ^ a.cc:117:48: warning: multi-character literal with 17 characters exceeds 'int' size of 4 bytes 117 | terminate called after throwing an instance of 'std::out_of_range' | ^~~~~~~~~~~~~~~~~~~ a.cc:118:50: warning: integer constant is so large that it is unsigned 118 | what(): basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 18446744073709551614) | ^~~~~~~~~~~~~~~~~~~~ a.cc:118:97: warning: integer constant is so large that it is unsigned 118 | what(): basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 18446744073709551614) | ^~~~~~~~~~~~~~~~~~~~ a.cc:123:1: error: extended character ❯ is not valid in an identifier 123 | ❯ act abc066 b | ^ a.cc:133:48: warning: multi-character literal with 17 characters exceeds 'int' size of 4 bytes 133 | terminate called after throwing an instance of 'std::out_of_range' | ^~~~~~~~~~~~~~~~~~~ a.cc:134:50: warning: integer constant is so large that it is unsigned 134 | what(): basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 18446744073709551614) | ^~~~~~~~~~~~~~~~~~~~ a.cc:134:97: warning: integer constant is so large that it is unsigned 134 | what(): basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 18446744073709551614) | ^~~~~~~~~~~~~~~~~~~~ a.cc:139:1: error: extended character ❯ is not valid in an identifier 139 | ❯ act abc066 b | ^ a.cc:151:1: error: extended character ❯ is not valid in an identifier 151 | ❯ act abc066 b | ^ a.cc:164:1: error: extended character ❯ is not valid in an identifier 164 | ❯ arc081 a | ^ a.cc:168:1: error: extended character ❯ is not valid in an identifier 168 | ❯ act arc081 a | ^ a.cc:179:1: error: extended character ❯ is not valid in an identifier 179 | ❯ act arc081 a | ^ a.cc:190:1: error: extended character ❯ is not valid in an identifier 190 | ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main | ^ a.cc:200:1: error: extended character ❯ is not valid in an identifier 200 | ❯ act arc081 a | ^ a.cc:212:1: error: extended character ❯ is not valid in an identifier 212 | ❯ act abc076 c | ^ a.cc:219:47: warning: missing terminating ' character 219 | Sample Input 3 : WA ans = <var>S</var> <var>T'</var>, wa = UNRESTORABLE | ^ a.cc:219:47: error: missing terminating ' character 219 | Sample Input 3 : WA ans = <var>S</var> <var>T'</var>, wa = UNRESTORABLE | ^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:225:1: error: extended character ❯ is not valid in an identifier 225 | ❯ act abc076 c | ^ a.cc:232:47: warning: missing terminating ' character 232 | Sample Input 3 : WA ans = <var>S</var> <var>T'</var>, wa = UNRESTORABLE | ^ a.cc:232:47: error: missing terminating ' character 232 | Sample Input 3 : WA ans = <var>S</var> <var>T'</var>, wa = UNRESTORABLE | ^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:238:1: error: extended character ❯ is not valid in an identifier 238 | ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main | ^ a.cc:244:1: error: extended character ❯ is not valid in an identifier 244 | ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main | ^ a.cc:250:1: error: extended character ❯ is not valid in an identifier 250 | ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main | ^ a.cc:256:1: error: extended character ❯ is not valid in an identifier 256 | ❯ act arc097 c | ^ a.cc:267:1: error: extended character ❯ is not valid in an identifier 267 | ❯ act arc097 c | ^ a.cc:278:1: error: extended character ❯ is not valid in an identifier 278 | ❯ act arc097 b | ^ a.cc:291:1: error: extended character ❯ is not valid in an identifier 291 | ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main | ^ a.cc:298:1: error: extended character ❯ is not valid in an identifier 298 | ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main | ^ a.cc:305:1: error: extended character ❯ is not valid in an identifier 305 | ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main | ^ a.cc:312:1: error: extended character ❯ is not valid in an identifier 312 | ❯ cd "/Users/ryochansq/workspace/atcoder/" && g++ main.cpp -o main && "/Users/ryochansq/workspace/atcoder/"main | ^ a.cc:319:1: error: extended character ❯ is not valid in an identifier 319 | ❯ | ^ a.cc:2:2: error: expected class-name before '/' token 2 | ~/workspace/atcoder master | ^
s528638699
p03938
C++
// #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define int long long #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define rep(i, n) for (int i = 0; i < n; ++i) #define REP(i, n) for (int i = 0; i < n; ++i) #define range(i,a,b) ((a)<=(i) && (i)<(b)) #define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl; #define fs first #define sc second #define pb push_back typedef long long ll; typedef pair<ll, ll> P; typedef tuple<ll, ll, ll> T; typedef priority_queue<ll> PQI; typedef priority_queue<P> PQP; typedef vector<vector<P>> pvec; typedef vector<vector<ll>> vvec; typedef vector<ll> vec; const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1}; const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1}; const int MOD = (1000000007); // const int MOD = (998244353); // const int INF = (1 << 30); const int INF = (1LL << 60); const double EPS = (1 >> 30); template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;} template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;} signed main() { ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15); //--------------------------------------------- int n; cin>>n; vector<int> c(n); REP(i,n) cin >> c[i]; vec a(n),b(n); rep(i,n){ a[i]=30000*(i+1); b[i]=30000*(n-(i+1))+r[i]; } rep(i,n) cout<<a[i]<<endl; rep(i,n) cout<<b[i]<<endl; }
a.cc: In function 'int main()': a.cc:48:30: error: 'r' was not declared in this scope 48 | b[i]=30000*(n-(i+1))+r[i]; | ^
s896826818
p03938
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n ; cin >> n ; int p[20010]; for(int i=1;i<=n;i++) cin >> p[i]; for(int i=1;i<=n;i++) a[i]=1+30000*(i-1),b[i]=1+30000*(n-i); for(int i=1;i<=n;i++){ a[p[i]] += i; } for(int i=1;i<=n;i++) cout<<a[i]<<" "; cout<<endl; for(int i=1;i<=n;i++) cout<<b[i]<<" "; cout<<endl; }
a.cc: In function 'int main()': a.cc:16:17: error: 'a' was not declared in this scope 16 | a[i]=1+30000*(i-1),b[i]=1+30000*(n-i); | ^ a.cc:16:36: error: 'b' was not declared in this scope 16 | a[i]=1+30000*(i-1),b[i]=1+30000*(n-i); | ^ a.cc:19:5: error: 'a' was not declared in this scope 19 | a[p[i]] += i; | ^ a.cc:23:23: error: 'a' was not declared in this scope 23 | cout<<a[i]<<" "; | ^ a.cc:27:23: error: 'b' was not declared in this scope 27 | cout<<b[i]<<" "; | ^
s214953198
p03938
C++
#include<iostream> #include<vector> #include<algorithm> #include<string> #include<iomanip> #include<set> #include<queue> using namespace std; int main() { int n; cin >> n; vector<int>p(n); for(int i=0;i<n;i++) { cin>>p[i]; p[i]—; } vector<int> a(n); vector<int> b(n); for(int i=0;i<n;i++)a[i]=i+1; for(int i=0;i<n;i++)b[i]=n-i; int bef=0; for(int i=0;i<n;i++) { if(a[p[i]]+b[p[i]]>bef) { b[p[i]]=(bef-a[p[i]]+1); bef=a[p[i]]+b[p[i]]; } } for(int i=0;i<n;i++)cout<<a[i]<<endl; for(int i=0;i<n;i++)cout<<b[i]<<endl; }
a.cc:19:5: error: extended character — is not valid in an identifier 19 | p[i]—; | ^ a.cc: In function 'int main()': a.cc:19:5: error: expected ';' before '\U00002014' 19 | p[i]—; | ^ | ; a.cc:19:4: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result] 19 | p[i]—; | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /usr/include/c++/14/bits/stl_vector.h:1128:7: note: declared here 1128 | operator[](size_type __n) _GLIBCXX_NOEXCEPT | ^~~~~~~~
s473222567
p03938
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(ll i=0;i<(ll)(n);i++) signed main(){ ll n,m=0,x,A=0,B=0,m;cin>>n; vector<ll> s(n),a(n),b(n); rep(i,n){ cin>>x; s[x-1]=i; } rep(i,n){ if(A+B>=s[i]){ A++; B=s[i]-A; }else{ B--; A=s[i]-B; } a[i]=A;b[i]=B; m=min(m,B-1); } rep(i,n)cout<<a[i]-m<< (i==n-1 ? '\n':' '); rep(i,n)cout<<b[i]-m<< (i==n-1 ? '\n':' '); }
a.cc: In function 'int main()': a.cc:7:24: error: redeclaration of 'll m' 7 | ll n,m=0,x,A=0,B=0,m;cin>>n; | ^ a.cc:7:10: note: 'll m' previously declared here 7 | ll n,m=0,x,A=0,B=0,m;cin>>n; | ^
s849350786
p03938
C++
3 2 3 1
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 3 | ^
s497418959
p03938
C++
3 2 3 1
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 3 | ^
s816291206
p03938
C
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n), a(n), b(n); for (int i = 0; i < n; i++) { cin >> v[i]; v[i]--; if (i == 0) { a[v[i]] = 1; b[v[i]] = 1000000000; } else { a[v[i]] = a[v[i - 1]] + 2; b[v[i]] = b[v[i - 1]] - 1; } } for (auto &p : a) cout << p << " "; cout << endl; for (auto &p : b) cout << p << " "; }
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s054238577
p03938
C++
#include<cstdio> #define MN 20005 int n,a[MN],i; int main(){ scanf("%d",&n); for(i=0,x;i<n;i++)scanf("%d",&x),a[x]=i+1; for(i=1;i<=n;i++)printf("%d%c",a[i]+i*MN,i<n?' ':'\n'); for(i=1;i<=n;i++)printf("%d ",(n-i+1)*MN); return 0; }
a.cc: In function 'int main()': a.cc:6:11: error: 'x' was not declared in this scope 6 | for(i=0,x;i<n;i++)scanf("%d",&x),a[x]=i+1; | ^
s953324761
p03938
C++
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ int n;cin>>n; vector<int>p(n),a(n),b(n); for(auto&& w:p)cin>>w; int d=30000; for(int i=0;i<n;i++)a[i]=d*(i+1);b[i]=d*(n-i)+p[i]; for(int i=0;i<n-1;i++)cout<<a[i]<<" "; cout<<a[n-1]<<endl; for(int i=0;i<n-1;i++)cout<<b[i]<<" "; cout<<b[n-1]<<endl; }
a.cc: In function 'int main()': a.cc:10:44: error: 'i' was not declared in this scope 10 | for(int i=0;i<n;i++)a[i]=d*(i+1);b[i]=d*(n-i)+p[i]; | ^
s447204023
p03938
C++
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <tuple> #include <queue> #include <cmath> #include <cfloat> #include <set> #include <map> // statics using namespace std; using int64 = int_fast64_t; using PAIR = pair<int64, int64>; constexpr int INF = 1 << 30; constexpr int64 LINF = 1LL << 60; constexpr int MOD = 1e9 + 7; constexpr int MAX_N = 3e5 + 1; // init/input #define int int64 #define INIT ios::sync_with_stdio(false);cin.tie(0); #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__); template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;} template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);} #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i; // out #define OUT(dist) cout<<(dist); #define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist); #define SP cout<<" "; #define BR cout<<endl; #define zero(n) cout<<setfill('0')<<right<<setw(n) #define debug(x) cerr<<#x<<":"<< (x);BR; // utility #define ALL(a) (a).begin(), (a).end() #define EACH(i, a) for(auto &&i:(a)) #define FOR(i, a, b) for(int i=(a);i<(b);++i) #define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i) #define REP(i, n) for(int i=0;i<(n);++i) #define RREP(i, n) for(int i=(n)-1;i>=0;--i) signed main() { INIT; VAR(int, n); VEC(int, p, n); vector<int> a(n); iota(ALL(a), 1); vector<int> b(n); b[p.back()-1] = 1e9; int last = 1e9+a[p.back()-1]; RREP(i,n){ // ai+bi < aj+bj; b[p[i]-1] = last - a[p[i]-1]-1; last--; } REP(i, n){ OUT(a[i]); if (i < n-1) {SP;} else {BR;} } REP(i, n){ OUT(b[i]); if (i < n-1) {SP;} else {BR;} } return 0; }
a.cc:14:15: error: 'int_fast64_t' does not name a type 14 | using int64 = int_fast64_t; | ^~~~~~~~~~~~ a.cc:15:19: error: 'int64' was not declared in this scope 15 | using PAIR = pair<int64, int64>; | ^~~~~ a.cc:15:26: error: 'int64' was not declared in this scope 15 | using PAIR = pair<int64, int64>; | ^~~~~ a.cc:15:31: error: template argument 1 is invalid 15 | using PAIR = pair<int64, int64>; | ^ a.cc:15:31: error: template argument 2 is invalid a.cc:17:11: error: 'int64' does not name a type; did you mean 'int64_t'? 17 | constexpr int64 LINF = 1LL << 60; | ^~~~~ | int64_t a.cc: In function 'int main()': a.cc:22:13: error: 'int64' was not declared in this scope 22 | #define int int64 | ^~~~~ a.cc:24:24: note: in definition of macro 'VAR' 24 | #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__); | ^~~~ a.cc:47:13: note: in expansion of macro 'int' 47 | VAR(int, n); | ^~~ a.cc:47:18: error: 'n' was not declared in this scope; did you mean 'yn'? 47 | VAR(int, n); | ^ a.cc:24:56: note: in definition of macro 'VAR' 24 | #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__); | ^~~~~~~~~~~ a.cc:27:36: error: template argument 2 is invalid 27 | #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i; | ^ a.cc:48:9: note: in expansion of macro 'VEC' 48 | VEC(int, p, n); | ^~~ a.cc:48:18: error: 'begin' was not declared in this scope; did you mean 'std::begin'? 48 | VEC(int, p, n); | ^ a.cc:27:56: note: in definition of macro 'VEC' 27 | #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i; | ^ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here 114 | template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept; | ^~~~~ a.cc:48:18: error: 'end' was not declared in this scope; did you mean 'std::end'? 48 | VEC(int, p, n); | ^ a.cc:27:56: note: in definition of macro 'VEC' 27 | #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i; | ^ /usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here 116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept; | ^~~ a.cc:49:19: error: template argument 2 is invalid 49 | vector<int> a(n); | ^ a.cc:38:20: error: request for member 'begin' in 'a', which is of non-class type 'int' 38 | #define ALL(a) (a).begin(), (a).end() | ^~~~~ a.cc:50:14: note: in expansion of macro 'ALL' 50 | iota(ALL(a), 1); | ^~~ a.cc:38:33: error: request for member 'end' in 'a', which is of non-class type 'int' 38 | #define ALL(a) (a).begin(), (a).end() | ^~~ a.cc:50:14: note: in expansion of macro 'ALL' 50 | iota(ALL(a), 1); | ^~~ a.cc:50:9: error: 'iota' was not declared in this scope 50 | iota(ALL(a), 1); | ^~~~ a.cc:51:19: error: template argument 2 is invalid 51 | vector<int> b(n); | ^ a.cc:52:13: error: request for member 'back' in 'p', which is of non-class type 'int' 52 | b[p.back()-1] = 1e9; | ^~~~ a.cc:53:13: error: expected ';' before 'last' 53 | int last = 1e9+a[p.back()-1]; | ^~~~ a.cc:54:14: error: expected ';' before 'i' 54 | RREP(i,n){ | ^ a.cc:43:28: note: in definition of macro 'RREP' 43 | #define RREP(i, n) for(int i=(n)-1;i>=0;--i) | ^ a.cc:54:14: error: 'i' was not declared in this scope 54 | RREP(i,n){ | ^ a.cc:43:36: note: in definition of macro 'RREP' 43 | #define RREP(i, n) for(int i=(n)-1;i>=0;--i) | ^ a.cc:56:29: error: 'last' was not declared in this scope 56 | b[p[i]-1] = last - a[p[i]-1]-1; | ^~~~ a.cc:59:13: error: expected ';' before 'i' 59 | REP(i, n){ | ^ a.cc:42:27: note: in definition of macro 'REP' 42 | #define REP(i, n) for(int i=0;i<(n);++i) | ^ a.cc:59:13: error: 'i' was not declared in this scope 59 | REP(i, n){ | ^ a.cc:42:31: note: in definition of macro 'REP' 42 | #define REP(i, n) for(int i=0;i<(n);++i) | ^ a.cc:64:13: error: expected ';' before 'i' 64 | REP(i, n){ | ^ a.cc:42:27: note: in definition of macro 'REP' 42 | #define REP(i, n) for(int i=0;i<(n);++i) | ^ a.cc:64:13: error: 'i' was not declared in this scope 64 | REP(i, n){ | ^ a.cc:42:31: note: in definition of macro 'REP' 42 | #define REP(i, n) for(int i=0;i<(n);++i) | ^
s354402821
p03938
C++
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <tuple> #include <queue> #include <cmath> #include <cfloat> #include <set> #include <map> // statics using namespace std; using int64 = int_fast64_t; using PAIR = pair<int64, int64>; constexpr int INF = 1 << 30; constexpr int64 LINF = 1LL << 60; constexpr int MOD = 1e9 + 7; constexpr int MAX_N = 3e5 + 1; // init/input #define int int64 #define INIT ios::sync_with_stdio(false);cin.tie(0); #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__); template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;} template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);} #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i; // out #define OUT(dist) cout<<(dist); #define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist); #define SP cout<<" "; #define BR cout<<endl; #define zero(n) cout<<setfill('0')<<right<<setw(n) #define debug(x) cerr<<#x<<":"<< (x);BR; // utility #define ALL(a) (a).begin(), (a).end() #define EACH(i, a) for(auto &&i:(a)) #define FOR(i, a, b) for(int i=(a);i<(b);++i) #define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i) #define REP(i, n) for(int i=0;i<(n);++i) #define RREP(i, n) for(int i=(n)-1;i>=0;--i) signed main() { INIT; VAR(int, n); VEC(int, p, n); vector<int> a(n); iota(ALL(a), 1); vector<int> b(n); b[p.back()-1] = 1e9; int last = 1e9+a[p.back()-1]; RREP(i,n){ // ai+bi < aj+bj; b[p[i]-1] = last - a[p[i]-1]-1; last--; } REP(i, n){ OUT(a[i]); if (i < n-1) {SP}; else {BR}; } REP(i, n){ OUT(b[i]); if (i < n-1) {SP}; else {BR}; } return 0; }
a.cc:14:15: error: 'int_fast64_t' does not name a type 14 | using int64 = int_fast64_t; | ^~~~~~~~~~~~ a.cc:15:19: error: 'int64' was not declared in this scope 15 | using PAIR = pair<int64, int64>; | ^~~~~ a.cc:15:26: error: 'int64' was not declared in this scope 15 | using PAIR = pair<int64, int64>; | ^~~~~ a.cc:15:31: error: template argument 1 is invalid 15 | using PAIR = pair<int64, int64>; | ^ a.cc:15:31: error: template argument 2 is invalid a.cc:17:11: error: 'int64' does not name a type; did you mean 'int64_t'? 17 | constexpr int64 LINF = 1LL << 60; | ^~~~~ | int64_t a.cc: In function 'int main()': a.cc:22:13: error: 'int64' was not declared in this scope 22 | #define int int64 | ^~~~~ a.cc:24:24: note: in definition of macro 'VAR' 24 | #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__); | ^~~~ a.cc:47:13: note: in expansion of macro 'int' 47 | VAR(int, n); | ^~~ a.cc:47:18: error: 'n' was not declared in this scope; did you mean 'yn'? 47 | VAR(int, n); | ^ a.cc:24:56: note: in definition of macro 'VAR' 24 | #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__); | ^~~~~~~~~~~ a.cc:27:36: error: template argument 2 is invalid 27 | #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i; | ^ a.cc:48:9: note: in expansion of macro 'VEC' 48 | VEC(int, p, n); | ^~~ a.cc:48:18: error: 'begin' was not declared in this scope; did you mean 'std::begin'? 48 | VEC(int, p, n); | ^ a.cc:27:56: note: in definition of macro 'VEC' 27 | #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i; | ^ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here 114 | template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept; | ^~~~~ a.cc:48:18: error: 'end' was not declared in this scope; did you mean 'std::end'? 48 | VEC(int, p, n); | ^ a.cc:27:56: note: in definition of macro 'VEC' 27 | #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i; | ^ /usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here 116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept; | ^~~ a.cc:49:19: error: template argument 2 is invalid 49 | vector<int> a(n); | ^ a.cc:38:20: error: request for member 'begin' in 'a', which is of non-class type 'int' 38 | #define ALL(a) (a).begin(), (a).end() | ^~~~~ a.cc:50:14: note: in expansion of macro 'ALL' 50 | iota(ALL(a), 1); | ^~~ a.cc:38:33: error: request for member 'end' in 'a', which is of non-class type 'int' 38 | #define ALL(a) (a).begin(), (a).end() | ^~~ a.cc:50:14: note: in expansion of macro 'ALL' 50 | iota(ALL(a), 1); | ^~~ a.cc:50:9: error: 'iota' was not declared in this scope 50 | iota(ALL(a), 1); | ^~~~ a.cc:51:19: error: template argument 2 is invalid 51 | vector<int> b(n); | ^ a.cc:52:13: error: request for member 'back' in 'p', which is of non-class type 'int' 52 | b[p.back()-1] = 1e9; | ^~~~ a.cc:53:13: error: expected ';' before 'last' 53 | int last = 1e9+a[p.back()-1]; | ^~~~ a.cc:54:14: error: expected ';' before 'i' 54 | RREP(i,n){ | ^ a.cc:43:28: note: in definition of macro 'RREP' 43 | #define RREP(i, n) for(int i=(n)-1;i>=0;--i) | ^ a.cc:54:14: error: 'i' was not declared in this scope 54 | RREP(i,n){ | ^ a.cc:43:36: note: in definition of macro 'RREP' 43 | #define RREP(i, n) for(int i=(n)-1;i>=0;--i) | ^ a.cc:56:29: error: 'last' was not declared in this scope 56 | b[p[i]-1] = last - a[p[i]-1]-1; | ^~~~ a.cc:59:13: error: expected ';' before 'i' 59 | REP(i, n){ | ^ a.cc:42:27: note: in definition of macro 'REP' 42 | #define REP(i, n) for(int i=0;i<(n);++i) | ^ a.cc:59:13: error: 'i' was not declared in this scope 59 | REP(i, n){ | ^ a.cc:42:31: note: in definition of macro 'REP' 42 | #define REP(i, n) for(int i=0;i<(n);++i) | ^ a.cc:62:17: error: 'else' without a previous 'if' 62 | else {BR}; | ^~~~ a.cc:64:13: error: expected ';' before 'i' 64 | REP(i, n){ | ^ a.cc:42:27: note: in definition of macro 'REP' 42 | #define REP(i, n) for(int i=0;i<(n);++i) | ^ a.cc:64:13: error: 'i' was not declared in this scope 64 | REP(i, n){ | ^ a.cc:42:31: note: in definition of macro 'REP' 42 | #define REP(i, n) for(int i=0;i<(n);++i) | ^ a.cc:67:17: error: 'else' without a previous 'if' 67 | else {BR}; | ^~~~
s368610454
p03938
C++
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <tuple> #include <queue> #include <cmath> #include <cfloat> #include <set> #include <map> // statics using namespace std; using int64 = int_fast64_t; using PAIR = pair<int64, int64>; constexpr int INF = 1 << 30; constexpr int64 LINF = 1LL << 60; constexpr int MOD = 1e9 + 7; constexpr int MAX_N = 3e5 + 1; // init/input #define int int64 #define INIT ios::sync_with_stdio(false);cin.tie(0); #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__); template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;} template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);} #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i; // out #define OUT(dist) cout<<(dist); #define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist); #define SP cout<<" "; #define BR cout<<endl; #define zero(n) cout<<setfill('0')<<right<<setw(n) #define debug(x) cerr<<#x<<":"<< (x);BR; // utility #define ALL(a) (a).begin(), (a).end() #define EACH(i, a) for(auto &&i:(a)) #define FOR(i, a, b) for(int i=(a);i<(b);++i) #define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i) #define REP(i, n) for(int i=0;i<(n);++i) #define RREP(i, n) for(int i=(n)-1;i>=0;--i) signed main() { INIT; VAR(int, n); VEC(int, p, n); vector<int> a(n); iota(ALL(a), 1); vector<int> b(n); b[p.back()-1] = 1e9; int last = 1e9+a[p.back()-1]; RREP(i,n){ // ai+bi < aj+bj; b[p[i]-1] = last - a[p[i]-1]-1; last--; } REP(i, n){ OUT(a[i]); if (i < n-1) SP; else BR; } REP(i, n){ OUT(b[i]); if (i < n-1) SP; else BR; } return 0; }
a.cc:14:15: error: 'int_fast64_t' does not name a type 14 | using int64 = int_fast64_t; | ^~~~~~~~~~~~ a.cc:15:19: error: 'int64' was not declared in this scope 15 | using PAIR = pair<int64, int64>; | ^~~~~ a.cc:15:26: error: 'int64' was not declared in this scope 15 | using PAIR = pair<int64, int64>; | ^~~~~ a.cc:15:31: error: template argument 1 is invalid 15 | using PAIR = pair<int64, int64>; | ^ a.cc:15:31: error: template argument 2 is invalid a.cc:17:11: error: 'int64' does not name a type; did you mean 'int64_t'? 17 | constexpr int64 LINF = 1LL << 60; | ^~~~~ | int64_t a.cc: In function 'int main()': a.cc:22:13: error: 'int64' was not declared in this scope 22 | #define int int64 | ^~~~~ a.cc:24:24: note: in definition of macro 'VAR' 24 | #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__); | ^~~~ a.cc:47:13: note: in expansion of macro 'int' 47 | VAR(int, n); | ^~~ a.cc:47:18: error: 'n' was not declared in this scope; did you mean 'yn'? 47 | VAR(int, n); | ^ a.cc:24:56: note: in definition of macro 'VAR' 24 | #define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__); | ^~~~~~~~~~~ a.cc:27:36: error: template argument 2 is invalid 27 | #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i; | ^ a.cc:48:9: note: in expansion of macro 'VEC' 48 | VEC(int, p, n); | ^~~ a.cc:48:18: error: 'begin' was not declared in this scope; did you mean 'std::begin'? 48 | VEC(int, p, n); | ^ a.cc:27:56: note: in definition of macro 'VEC' 27 | #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i; | ^ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here 114 | template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept; | ^~~~~ a.cc:48:18: error: 'end' was not declared in this scope; did you mean 'std::end'? 48 | VEC(int, p, n); | ^ a.cc:27:56: note: in definition of macro 'VEC' 27 | #define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i; | ^ /usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here 116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept; | ^~~ a.cc:49:19: error: template argument 2 is invalid 49 | vector<int> a(n); | ^ a.cc:38:20: error: request for member 'begin' in 'a', which is of non-class type 'int' 38 | #define ALL(a) (a).begin(), (a).end() | ^~~~~ a.cc:50:14: note: in expansion of macro 'ALL' 50 | iota(ALL(a), 1); | ^~~ a.cc:38:33: error: request for member 'end' in 'a', which is of non-class type 'int' 38 | #define ALL(a) (a).begin(), (a).end() | ^~~ a.cc:50:14: note: in expansion of macro 'ALL' 50 | iota(ALL(a), 1); | ^~~ a.cc:50:9: error: 'iota' was not declared in this scope 50 | iota(ALL(a), 1); | ^~~~ a.cc:51:19: error: template argument 2 is invalid 51 | vector<int> b(n); | ^ a.cc:52:13: error: request for member 'back' in 'p', which is of non-class type 'int' 52 | b[p.back()-1] = 1e9; | ^~~~ a.cc:53:13: error: expected ';' before 'last' 53 | int last = 1e9+a[p.back()-1]; | ^~~~ a.cc:54:14: error: expected ';' before 'i' 54 | RREP(i,n){ | ^ a.cc:43:28: note: in definition of macro 'RREP' 43 | #define RREP(i, n) for(int i=(n)-1;i>=0;--i) | ^ a.cc:54:14: error: 'i' was not declared in this scope 54 | RREP(i,n){ | ^ a.cc:43:36: note: in definition of macro 'RREP' 43 | #define RREP(i, n) for(int i=(n)-1;i>=0;--i) | ^ a.cc:56:29: error: 'last' was not declared in this scope 56 | b[p[i]-1] = last - a[p[i]-1]-1; | ^~~~ a.cc:59:13: error: expected ';' before 'i' 59 | REP(i, n){ | ^ a.cc:42:27: note: in definition of macro 'REP' 42 | #define REP(i, n) for(int i=0;i<(n);++i) | ^ a.cc:59:13: error: 'i' was not declared in this scope 59 | REP(i, n){ | ^ a.cc:42:31: note: in definition of macro 'REP' 42 | #define REP(i, n) for(int i=0;i<(n);++i) | ^ a.cc:62:17: error: 'else' without a previous 'if' 62 | else BR; | ^~~~ a.cc:64:13: error: expected ';' before 'i' 64 | REP(i, n){ | ^ a.cc:42:27: note: in definition of macro 'REP' 42 | #define REP(i, n) for(int i=0;i<(n);++i) | ^ a.cc:64:13: error: 'i' was not declared in this scope 64 | REP(i, n){ | ^ a.cc:42:31: note: in definition of macro 'REP' 42 | #define REP(i, n) for(int i=0;i<(n);++i) | ^ a.cc:67:17: error: 'else' without a previous 'if' 67 | else BR; | ^~~~
s936994377
p03938
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> P; #define MOD 1000000007 int main(){ ll n; cin>>n; ll p[n],a[n],b[n]; for(int i=0;i<n;i++){ cin>>p[i]; a[p[i]-1]=i+1; b[p[i]-1]=n*2-1-(i*2); } for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl; for(int i=0;i<n;i++ cout<<b[i]<<" "; }
a.cc: In function 'int main()': a.cc:17:22: error: expected ')' before 'cout' 17 | for(int i=0;i<n;i++ cout<<b[i]<<" "; | ~ ^~~~~ | )
s225140584
p03938
C++
#include<bits/stdc++h> using namespace std; typedef long long ll; typedef pair<ll,ll> P; #define MOD 1000000007 int main(){ ll n; cin>>n; ll p[n],a[n],b[n]; for(int i=0;i<n;i++){ cin>>p[i]; a[p[i]-1]=i+1; b[p[i]-1]=n*2-1-(i*2); } for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl; for(int i=0;i<n;i++ cout<<b[i]<<" "; }
a.cc:1:9: fatal error: bits/stdc++h: No such file or directory 1 | #include<bits/stdc++h> | ^~~~~~~~~~~~~~ compilation terminated.
s054111270
p03938
C++
#include<cstdio> using namespace std; int main(){ int n,p[20001],a; scanf("%d"&n); for(int i=0;i<n;i++){ scanf("%d",a); p[a]=i; } for(int i=1;i<=n;i++) printf("%d ",n*i); printf("\n"); for(int i=1;i<=n;i++) printf("%d ",n*i+p[a]); printf("\n"); }
a.cc: In function 'int main()': a.cc:5:13: error: invalid operands of types 'const char [3]' and 'int' to binary 'operator&' 5 | scanf("%d"&n); | ~~~~^~ | | | | | int | const char [3]
s692531720
p03938
C++
ERROR: type should be string, got "https://beta.atcoder.jp/contests/agc007/submissions/3515368#define _USE_MATH_DEFINES \n#include <iostream>\n#include <fstream>\n#include <cstdio>\n#include <cmath>\n#include <cstdlib>\n#include <cstring>\n#include <cassert>\n#include <string>\n#include <vector>\n#include <utility>\n#include <complex>\n#include <set>\n#include <map>\n#include <queue>\n#include <stack>\n#include <deque>\n#include <tuple>\n#include <bitset>\n#include <limits>\n#include <algorithm>\n#include <array>\n#include <random>\n#include <complex>\n#include <regex>\nusing namespace std;\ntypedef long double ld;\ntypedef long long ll;\ntypedef vector<int> vint;\ntypedef vector<ll> vll;\ntypedef pair<int, int> pii;\ntypedef pair<ll, ll> pll;\ntypedef pair<double, double> pdd;\n#define quickIO() {cin.tie(0); cout.sync_with_stdio(false);}\n#define rep(i,n) for(ll i=0; i<(ll)n; i++)\n#define mp(a,b) make_pair(a,b)\n#define pb push_back\n#define fcout cout << fixed << setprecision(10) \nconst ll inf = 1e18;\nconst ll mod = 1e9 +7;\n \nld sqrtld(ld x){\n ld left = 0, right = x;\n rep(i, 100){\n ld mid = (left + right)/2;\n if (mid*mid <= x) left =mid;\n else right = mid;\n }\n return left;\n}\n\nll gcd(ll a, ll b){\n if(b>a){\n ll c =b; b=a; a=c;\n }\n ll d = a%b;\n if(d==0){\n return b;\n }else if(d==1){\n return 1;\n }else{\n gcd(b,d);\n }\n}\n\n\nll cul(ll n){\n return (n-1)*n/2;\n}\n\n\nint a[20010];\nint main (){\n int n; cin >> n;\n rep(i,n){\n int p=0;\n cin >> p;\n a[p] +=i;\n }\n\n for(int i=1; i<=n; i++){\n cout << 25000 * 1 +a[i] << \" \" ;\n }\n cout << endl;\n for(int i=n; i>0; i--){\n cout << 25000 * i << \" \" ;\n }\n cout << endl;\n return 0;\n}\n\n"
a.cc:1:1: error: 'https' does not name a type 1 | https://beta.atcoder.jp/contests/agc007/submissions/3515368#define _USE_MATH_DEFINES | ^~~~~ In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/exception_ptr.h:38, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared 140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared 142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:145:52: error: expected primary-expression before 'const' 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:147:54: error: expected primary-expression before 'const' 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive] 155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:156:70: error: expected primary-expression before 'const' 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive] 163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:164:72: error: expected primary-expression before 'const' 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared 171 | void operator delete(void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared 173 | void operator delete[](void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function 179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:179:51: error: 'size_t' is
s197844227
p03938
C++
#include <bits/stdc++.h> #define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++) #define rrep(i,a,b) for(long long int i=(a);i<(b);i++) #define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--) #define all(v) (v).begin(), (v).end() #define pb(q) push_back(q) #define Abs(a,b) max(a,b)-min(a,b) #define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;} #define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;} #define Cout(x) cout<<(x)<<endl #define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;} #define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;} #define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;} #define Size(n) (n).size() typedef long long ll; using namespace std; const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6; const ll LINF = 1e18; long long int n,cnt=0,ans[ohara],a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos; int dy[]={1,0,-1,0}; int dx[]={0,1,0,-1}; string alph("abcdefghijklmnopqrstuvwxyz"),s; bool fl=true; struct edge{int to,cost;}; //-------------------------↓↓↓↓↓↓------------------------ int main(void){ cin.tie(0); ios::sync_with_stdio(false); cin>>n; map<ll,ll> mp; ll cntt=0; rep(i,n){ cin>>a; a--; mp[a]=i; //p[i]=make_pair(a,0); cntt+=3000; } cout<<1; ans[0]=1; cnt=1; for(ll i=30000;cnt<=n;i+=30000){ if(cnt==n){ cout<<"\n"; break; } cnt++; cout<<" "<<i; ans[cnt-1]=i; } reverse(ans,ans+cnt); rep(i,n){ if(ans[i]-mp[i]<=0){ cout<0; } else{ cout<<ans[i]-mp[i]; } if(i==n-1)cout<<"\n"; else cout<<" "; } return 0; }
a.cc: In function 'int main()': a.cc:65:15: error: no match for 'operator<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 65 | cout<0; | ~~~~^~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:65:15: note: candidate: 'operator<(int, int)' (built-in) 65 | cout<0; | ~~~~^~ a.cc:65:15: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/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:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:65:16: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 65 | cout<0; | ^ /usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:65:16: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 65 | cout<0; | ^ /usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:65:16: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 65 | cout<0; | ^ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:65:16: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 65 | cout<0; | ^ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:65:16: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 65 | cout<0; | ^ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:65:16: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 65 | cout<0; | ^ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:65:16: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 65 | cout<0; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:65:16: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>' 65 | cout<0; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:65:16: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 65 | cout<0; | ^ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:65:16: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 65 | cout<0; | ^ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:65:16: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 65 | cout<0; | ^ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:65:16: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 65 | cout<0; | ^ 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:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:65:16: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 65 | cout<0; | ^ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:65:16: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 65 | cout<0; | ^ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:65:16: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 65 | cout<0; | ^ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:65:16: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Trai
s374538488
p03938
C++
#include <iostream> #include <vector> #define inf 1e9 using namespace std; // range-add, range-min query struct SegTree{ int size; vector<int> seg, delay; SegTree(){} SegTree(int size){ this->size = size; seg.resize(1<<(size+1)); delay.resize(1<<(size+1)); } void init() { for(int i = 0; i < (1<<(size+1)); i++){ seg[i] = inf; delay[i] = 0; } } void eval(int l, int r, int k) { if(delay[k]){ seg[k] += delay[k]; if(l < r){ delay[k*2] += delay[k]; delay[k*2+1] += delay[k]; } delay[k] = 0; } } void update(int i, int val) { i += (1 << size); seg[i] = val; while(i > 1){ i /= 2; seg[i] = min(seg[i*2], seg[i*2+1]); } } void add(int a, int b, int k, int l, int r, int val) { eval(l, r, k); if(b < l || r < a) return; if(a <= l && r <= b){ delay[k] += val; eval(l, r, k); return; } add(a, b, k*2, l, (l+r)/2, val); add(a, b, k*2+1, (l+r)/2+1, r, val); seg[k] = min(seg[k*2], seg[k*2+1]); } void add(int a, int b, int val){ if(a > b) return; add(a, b, 1, 0, (1<<size)-1, val); } int query(int a, int b, int k, int l, int r) { eval(l, r, k); if(b < l || r < a) return inf; if(a <= l && r <= b) return seg[k]; int lval = query(a, b, k*2, l, (l+r)/2); int rval = query(a, b, k*2+1, (l+r)/2+1, r); return min(lval, rval); } int query(int a, int b) { return query(a, b, 1, 0, (1<<size)-1); } }; int n; int p[20005]; int rank[20005]; SegTree segA(15), segB(15); int main(void) { cin >> n; for(int i = 1; i <= n; i++) cin >> p[i]; for(int i = 1; i <= n; i++) rank[p[i]] = i; segA.init(); segB.init(); for(int i = 1; i <= n; i++){ segB.update(i, n-i+1); } for(int i = 1; i <= n; i++){ segA.update(i, rank[i]+n - (n-i+1)); } for(int i = 1; i < n; i++){ int mn = segA.query(i+1, n); int val = segA.query(i, i); if(mn > val) continue; segA.add(i+1, n, val - mn + 1); segB.add(1, i, val - mn + 1); } for(int i = 1; i <= n; i++) cout << segA.query(i, i) << " "; cout << endl; for(int i = 1; i <= n; i++) cout << segB.query(i, i) << " "; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:94:37: error: reference to 'rank' is ambiguous 94 | for(int i = 1; i <= n; i++) rank[p[i]] = i; | ^~~~ In file included from /usr/include/c++/14/bits/move.h:37, from /usr/include/c++/14/bits/exception_ptr.h:41, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:87:5: note: 'int rank [20005]' 87 | int rank[20005]; | ^~~~ a.cc:102:32: error: reference to 'rank' is ambiguous 102 | segA.update(i, rank[i]+n - (n-i+1)); | ^~~~ /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:87:5: note: 'int rank [20005]' 87 | int rank[20005]; | ^~~~
s055987623
p03938
C++
using namespace std; typedef long long ll; ll n, p[21000], a; int main(void){ // Your code here! cin >> n; for (ll i = 0; i < n; i++) { cin >> a; p[a] = i; } for (ll i = 1; i <= n; i++) { cout << i * n + p[i] << ' '; } cout << endl; for (ll i = n; i > 0; i--) { cout << i * n << ' '; } cout << endl; }
a.cc: In function 'int main()': a.cc:6:5: error: 'cin' was not declared in this scope 6 | cin >> n; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:12:9: error: 'cout' was not declared in this scope 12 | cout << i * n + p[i] << ' '; | ^~~~ a.cc:12:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:14:5: error: 'cout' was not declared in this scope 14 | cout << endl; | ^~~~ a.cc:14:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:14:13: error: 'endl' was not declared in this scope 14 | cout << endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | using namespace std;
s135651856
p03938
C++
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n; int p[30005]={0},a[30005]={0},b[30005]={0}; int main() { //asdf scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%d",&p[i]); a[i]=100000; for(int i=2;i<=n;i++)a[i]=a[i-1]+30000; for(int i=1;i<=n;i++)b[n-i+1]=a[i]; for(int i=1;i<=n;i++)b[p[i]]+=i; for(int i=1;i<=n;i++)cout<<a[i]<<" "; cout<<'\n'; for(int i=1;i<=n;i++)cout<<b[i]<<" "; return 0; }
a.cc: In function 'int main()': a.cc:13:11: error: 'i' was not declared in this scope 13 | a[i]=100000; | ^
s304820969
p03938
C++
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n; int p[30005]={0},a[30005]={0},b[30005]={0}; int main() { scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%d",&p[i]); a[i]=100000; for(int i=2;i<=n;i++)a[i]=a[i-1]+30000; for(int i=1;i<=n;i++)b[n-i+1]=a[i]; for(int i=1;i<=n;i++)b[p[i]]+=i; for(int i=1;i<=n;i++)cout<<a[i]<<" "; cout<<'\n'; for(int i=1;i<=n;i++)cout<<b[i]<<" "; return 0; }
a.cc: In function 'int main()': a.cc:12:11: error: 'i' was not declared in this scope 12 | a[i]=100000; | ^
s997996384
p03938
C++
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n; int p[30005]={0},a[30005]={0},b[30005]={0}; int main() { scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%d",&p[i]); a[i]=100000; for(int i=2;i<=n;i++)a[i]=a[i-1]+30000; for(int i=1;i<=n;i++)b[n-i+1]=a[i]; for(int i=1;i<=n;i++)b[p[i]]+=i; for(int i=1;i<=n;i++)cout<<a[i]<<" "; cout<<'\n'; for(int i=1;i<=n;i++)cout<<b[i]<<" "; return 0; }
a.cc: In function 'int main()': a.cc:12:11: error: 'i' was not declared in this scope 12 | a[i]=100000; | ^
s107544870
p03938
C++
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n; int p[30005]={0},a[30005]={0},b[30005]={0}; int main() { if (0){} scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%d",&p[i]); a[i]=100000; for(int i=2;i<=n;i++)a[i]=a[i-1]+30000; for(int i=1;i<=n;i++)b[n-i+1]=a[i]; for(int i=1;i<=n;i++)b[p[i]]+=i; for(int i=1;i<=n;i++)cout<<a[i]<<" "; cout<<'\n'; for(int i=1;i<=n;i++)cout<<b[i]<<" "; return 0; }
a.cc: In function 'int main()': a.cc:13:11: error: 'i' was not declared in this scope 13 | a[i]=100000; | ^
s525983462
p03938
C++
vector<bool> gen_sosuu(vector<bool> sosuu){ int size = sosuu.size(); REP(i,size){ sosuu[i] = true; } sosuu[0] = false; sosuu[1] = false; sosuu[2] = true; FOR(i,2,sqrt(size)+1){ if(sosuu[i] == false) continue; for(int j = 2; i*j<size;j++){ sosuu[i*j] =false; } } return sosuu; } int n; int p[200001]; int main(){ cin >>n; REP(i,n){ int x; cin >> x; p[x] = i+1; } FOR(i,1,n+1) cout << 30000*i << " "; cout <<endl; FOR(i,1,n+1) cout << 30000*(n-i) + p[i] << " "; cout <<endl; }
a.cc:3:1: error: 'vector' does not name a type 3 | vector<bool> gen_sosuu(vector<bool> sosuu){ | ^~~~~~ a.cc: In function 'int main()': a.cc:23:3: error: 'cin' was not declared in this scope 23 | cin >>n; | ^~~ a.cc:24:7: error: 'i' was not declared in this scope 24 | REP(i,n){ | ^ a.cc:24:3: error: 'REP' was not declared in this scope 24 | REP(i,n){ | ^~~ a.cc:29:3: error: 'FOR' was not declared in this scope 29 | FOR(i,1,n+1) cout << 30000*i << " "; | ^~~ a.cc:30:3: error: 'cout' was not declared in this scope 30 | cout <<endl; | ^~~~ a.cc:30:10: error: 'endl' was not declared in this scope 30 | cout <<endl; | ^~~~
s863621939
p03938
C++
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> pii; typedef long long int ll; #define INF 1 << 30 #define REP(i,n) for(ll i=0; i<(int)(n); i++) #define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++) vector<bool> gen_sosuu(vector<bool> sosuu){ int size = sosuu.size(); REP(i,size){ sosuu[i] = true; } sosuu[0] = false; sosuu[1] = false; sosuu[2] = true; FOR(i,2,sqrt(size)+1){ if(sosuu[i] == false) continue; for(int j = 2; i*j<size;j++){ sosuu[i*j] =false; } } return sosuu; } int n; int a[200001]; int b[200001]; int main(){ cin >>n; REP(i,n){ int x; cin >> x; p[x] = i+1; } FOR(i,1,n+1) cout << 30000*i << " "; cout <<endl; DOR(i,1,n+1) cout << 30000*(n-i) + p[i] << " "; cout <<endl; }
a.cc: In function 'int main()': a.cc:38:5: error: 'p' was not declared in this scope 38 | p[x] = i+1; | ^ a.cc:42:7: error: 'i' was not declared in this scope 42 | DOR(i,1,n+1) cout << 30000*(n-i) + p[i] << " "; | ^ a.cc:42:3: error: 'DOR' was not declared in this scope; did you mean 'FOR'? 42 | DOR(i,1,n+1) cout << 30000*(n-i) + p[i] << " "; | ^~~ | FOR
s163413924
p03938
C++
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <set> #include <bitset> #include <cmath> #include <string> #define FI first #define SE second #define PF push_front #define PB push_back #define PPF pop_front #define PPB pop_back #define MA make_pair #define ll long long #define PA pair<int,int> #define VE vector<int> #define VP vector<PA> #define FOR(i,a,b) for(int i=a;i<b;i++) #define ROF(i,a,b) for(int i=b-1;i>=a;i--) #define YES(i) cout<<(i?"YES":"NO")<<endl #define Yes(i) cout<<(i?"Yes":"No")<<endl using namespace std; // const int INF=1e9+7; const int mod=1e9+7; // // struct poi{ int X;int Y;int Z; bool operator<(const poi&R)const{ return X==R.X ? Y==R.Y ? Z<R.Z : Y<R.Y : X<R.X; } }; // // int A[200000]; int P[200000]; int B[200000]; int a[200000]; int b[200000]; int main(){ int N; cin>>N; FOR(i,0,N){ A[i]=1e9+i; } FOR(i,0,N){ cin>>P[i]; P[i]--; B[P[i]]=A[i]; } FOR(i,0,N){ a[i]=(i+1)*30000; b[i]=B[i]-a[i]; } FOR(i,0,N){ cout<<a[i]<<" \n"[i==N-1]; } FOR(i,0,N){ cout<<b[i]<<" \n"[i==N-1]; } return 0; }  
a.cc:66:1: error: extended character   is not valid in an identifier 66 |   | ^ a.cc:66:1: error: '\U00003000' does not name a type 66 |   | ^~
s710895889
p03938
C++
#include <iostream> using namespace std; int N; int A[20010].B[20010]; int main(){ cin >> N; for(int i=1;i<=N;i++){ cin >> A[i]; B[A[i]] = i; } for(int i=1;i<=N;i++){ if(i!=N) cout << 30000*i << " "; else cout << 30000*i << endl; } for(int i=1;i<=N;i++){ if(i!=N) cout << 30000*(N-i) + B[i] <<" "; else cout << 30000*(N-i) + B[i] << endl; } }
a.cc:5:13: error: expected initializer before '.' token 5 | int A[20010].B[20010]; | ^ a.cc: In function 'int main()': a.cc:10:24: error: 'A' was not declared in this scope 10 | cin >> A[i]; | ^ a.cc:11:17: error: 'B' was not declared in this scope 11 | B[A[i]] = i; | ^ a.cc:18:48: error: 'B' was not declared in this scope 18 | if(i!=N) cout << 30000*(N-i) + B[i] <<" "; | ^ a.cc:19:44: error: 'B' was not declared in this scope 19 | else cout << 30000*(N-i) + B[i] << endl; | ^
s760510684
p03938
C++
#include <bits/stdc++.h> //#include <math.h> using namespace std; #define INF 1.1e9 #define LINF 1.1e18 #define FOR(i,a,b) for (int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() #define pb push_back #define pf push_front #define fi first #define se second #define BIT(x,n) bitset<n>(x) #define PI 3.14159265358979323846 typedef long long ll; typedef pair<int,int> P; typedef pair<int,P> PP; //----------------------------------------------------------------------------- int n; int p[20000]; int a[20000],b[20000]; int main() { cin.tie(0); ios::sync_with_stdio(false); cin>>n; REP(i,n) cin>>p[i]; REP(i,n) { a[i]=i*40000+p[i]; b[i]=(n-i)*40000+p[i]; } REP(i,n) cout<<a[i]<<(i==n-1?endl:' '); REP(i,n) cout<<b[i]<<(i==n-1?endl:' '); return 0; }
a.cc: In function 'int main()': a.cc:37:43: error: overloaded function with no contextual type information 37 | REP(i,n) cout<<a[i]<<(i==n-1?endl:' '); | ^~~ a.cc:38:43: error: overloaded function with no contextual type information 38 | REP(i,n) cout<<b[i]<<(i==n-1?endl:' '); | ^~~
s907407097
p03938
C++
#include <iostream> #include <vector> #include <string> #include <cmath> #include <algorithm> #include <utility> #include <queue> #include <set> #include <map> #define inf 1000000007 #define ll long long #define PA pair<int,int> #define PPAP pair<int,PA> #define MP make_pair #define PB push_back using namespace std; int main(){ int n; cin >> n; vector<int> p(n); for(int i=0;i<n;i++){ cin >> p[i]; p[i]--; } vector<int> a(n),b(n); for(int i=1;i<=n;i++){ a[i-1] = 33000*i; b[p-i] = 33000*i; } for(int i=0;i<n;i++){ a[p[i]] += i; } for(int i=0;i<n-1;i++){ cout << a[i] << " "; } cout << a[n-1] << endl; for(int i=0;i<n-1;i++){ cout << b[i] << " "; } cout << b[n-1] << endl; return 0; }
a.cc: In function 'int main()': a.cc:31:20: error: no match for 'operator-' (operand types are 'std::vector<int>' and 'int') 31 | b[p-i] = 33000*i; | ~^~ | | | | | int | std::vector<int> In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 618 | operator-(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed: a.cc:31:21: note: 'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>' 31 | b[p-i] = 33000*i; | ^ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1790 | operator-(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed: a.cc:31:21: note: 'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>' 31 | b[p-i] = 33000*i; | ^
s722770973
p03938
C++
#include<bits\stdc++.h> using namespace std; const int maxn=20005; //int s[maxn]; int n; struct node { long long id,num,aa,bb; }s[maxn]; bool cmp1(node x,node y) { return x.num<y.num; } bool cmp2(node x,node y) { return x.id<y.id; } int main() { int n; scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&s[i].num); s[i].id=i; } sort(s+1,s+1+n,cmp1); long long ans=2*n+1; for(int i=1;i<=n;i++) { s[i].aa=i; s[i].bb=ans-i; ans--; } sort(s+1,s+1+n,cmp2); for(int i=1;i<=n;i++) cout<<s[i].aa<<' '; cout<<endl; for(int i=1;i<=n;i++) cout<<s[i].bb<<' '; cout<<endl; return 0; }
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s832862163
p03938
C++
#include <bits/stdc++.h> using namespace std; #define int long long #define Rep(i, N) for(int i = 0; i < N; i++) typedef pair<int, int> Pi; #define fi first #define se second const int INF = 1 << 28; signed main() { int N; Pi P[20005]; cin >> N; Rep(i, N) { cin >> P[i].fi; P[i].se = i; } sort(P, P + N); int A[20005], B[20005]; int a, b; a = b = 0; A[0] = a, B[0] = b; Rep(i, N - 1) { int sa1 = P[i + 1].se - P[i].se; int sa2 = P[i + 1].se - P[0].se; if(sa1 < 0) { a++; b = sa2 - a; } else { b--; a = sa2 - b; } A[i + 1] = a, B[i + 1] = b; } Rep(i, N - 1) cout << A[i] + LLINF << " "; cout << A[N - 1] + LLINF << endl; Rep(i, N - 1) cout << B[i] + LLINF << " "; cout << B[N - 1] + LLINF << endl; return 0; }
a.cc: In function 'int main()': a.cc:41:32: error: 'LLINF' was not declared in this scope; did you mean 'INF'? 41 | Rep(i, N - 1) cout << A[i] + LLINF << " "; cout << A[N - 1] + LLINF << endl; | ^~~~~ | INF a.cc:41:65: error: 'LLINF' was not declared in this scope; did you mean 'INF'? 41 | Rep(i, N - 1) cout << A[i] + LLINF << " "; cout << A[N - 1] + LLINF << endl; | ^~~~~ | INF
s658910399
p03938
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; const ll MOD = 1000000007; int main(){ int N; cin >> N; vector<int> p(N); for(int i=0;i<N;i++){ cin >> p[i]; } vector<int> a(N), b(N); for(int i=0;i<N;i++){ a[i] = 30000 * (i+1); b[i] = 30000 * (n-i); } for(int i=0;i<N;i++){ b[p[i]-1] += i; } for(int i=0;i<N;i++){ cout << (i ? " " : "") << a[i] << endl; } for(int i=0;i<N;i++){ cout << (i ? " " : "") << b[i] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:20:25: error: 'n' was not declared in this scope 20 | b[i] = 30000 * (n-i); | ^
s320493682
p03938
Java
import java.util.*; public class pB { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int p[] = new int [N]; for (int i = 0; i < N; i++) { p[i] = sc.nextInt() - 1; } int r[] = new int[N]; for (int i = 0; i < N; i++) { r[p[i]] = i + 1; } long a[] = new long[N]; long b[] = new long[N]; // 初期値の設定 for (int i = 0; i < N; i++) { a[i] = (N + 1) * (i + 1); b[i] = (N + 1) * (N - i - 1) + r[i]; } // 出力 for (long n : a) { System.out.print(n + " "); } System.out.println(""); for (long n : b) { System.out.print(n + " "); } sc.close(); } }
Main.java:2: error: class pB is public, should be declared in a file named pB.java public class pB { ^ 1 error
s623618700
p03938
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int p[] = new int [N]; for (int i = 0; i < N; i++) { p[i] = sc.nextInt() - 1; } int r[] = new int[N]; for (int i = 0; i < N; i++) { r[p[i]] = i + 1; } long a[] = new long[N]; long b[] = new long[N]; // 初期値の設定 for (int i = 0; i < N; i++) { a[i] = (N + 1) * (i + 1); b[i] = (N + 1) * (N - i - 1) + r[i]; } // 出力 for (long n : a) { System.out.print(n + " "); } System.out.println(""); for (long n : b) { System.out.print(n + " "); } sc.close(); }
Main.java:36: error: reached end of file while parsing } ^ 1 error
s798571779
p03938
Java
import java.util.*; public class pB { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int p[] = new int [N]; for (int i = 0; i < N; i++) { p[i] = sc.nextInt() - 1; } int r[] = new int[N]; for (int i = 0; i < N; i++) { r[p[i]] = i + 1; } long a[] = new long[N]; long b[] = new long[N]; // 初期値の設定 for (int i = 0; i < N; i++) { a[i] = 25000 * (i + 1); b[i] = 25000 * (N - i) + r[p[i]]; } // 出力 for (long n : a) { System.out.print(n + " "); } System.out.println(""); for (long n : b) { System.out.print(n + " "); } sc.close(); } }
Main.java:2: error: class pB is public, should be declared in a file named pB.java public class pB { ^ 1 error
s349124777
p03938
C++
#include <cstdio> #include <iostream> #include <cmath> #include <cstring> #include <sstream> #include <algorithm> #include <cstdlib> #include <map> #include <queue> #include <utility> #include <vector> #include <set> #include <memory.h> #include <iomanip> #include <bitset> #include <list> #include <stack> using namespace std; #define mod 1000000007 #define maxnum 1000000000 int main() { int n; cin >> n; int a[20010], b[20010], p[20010]; for(int i = 1; i <= n; i++){ a[i] = maxnum - n + i; b[i] = n - i + 1; int tmp; cin >> tmp; p[tmp] = i; } for(int i = 1; i <= n; i++){ cout << i * n + p[i]; if(i != n) cout << " "; } cout << endl; for(int i = 1; i <= n; i++){ cout << (n - i) * n; if(i != n) cout << " "; } cour << endl; return 0; }
a.cc: In function 'int main()': a.cc:45:5: error: 'cour' was not declared in this scope 45 | cour << endl; | ^~~~
s853834536
p03938
C++
#include<iostream> #include<vector> #include<algorithm> using namespace std; const int d = 20100; int main(){ vector<pair<int,int> > v; int N; cin>>N; for(int i=0;i<N;i++){ int p; cin>>p; p--; v.push_back(make_pair(p,i)); } sort(ALL(v)); vector<int> a(N),b(N); for(int i=0;i<N;i++){ a[i] = v[i].second; b[i] = 0; a[i] += d*i; b[i] += -d*i + 500000000; } for(int i=0;i<N;i++){ cout<<a[i]<<" "; } cout<<endl; for(int i=0;i<N;i++){ cout<<b[i]<<" "; } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:19:14: error: 'ALL' was not declared in this scope 19 | sort(ALL(v)); | ^~~
s968684412
p03938
C++
#include<iostream> #include<vector> #include<algorithm> using namespace std; const int d = 20100; int main(){ vector<pair<int,int> > v; int N; cin>>N; for(int i=0;i<N;i++){ int p; cin>>p; p--; v.push_back(make_pair(p,i)); } sort(ALL(v)); vector<int> a,b; for(int i=0;i<N;i++){ a[i] = v[i].second; b[i] = 0; a[i] += d*i; b[i] += -d*i + 500000000; } for(int i=0;i<N;i++){ cout<<a[i]<<" "; } cout<<endl; for(int i=0;i<N;i++){ cout<<b[i]<<" "; } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:19:14: error: 'ALL' was not declared in this scope 19 | sort(ALL(v)); | ^~~
s743752762
p03938
C++
#include<iostream> #include<vector> using namespace std; const int d = 20100; int main(){ vector<pair<int,int> > v; int N; cin>>N; for(int i=0;i<N;i++){ int p; cin>>p; p--; v.push_back(make_pair(p,i)); } sort(ALL(v)); vector<int> a,b; for(int i=0;i<N;i++){ a[i] = v[i].second; b[i] = 0; a[i] += d*i; b[i] += -d*i + 500000000; } for(int i=0;i<N;i++){ cout<<a[i]<<" "; } cout<<endl; for(int i=0;i<N;i++){ cout<<b[i]<<" "; } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:18:14: error: 'ALL' was not declared in this scope 18 | sort(ALL(v)); | ^~~ a.cc:18:9: error: 'sort' was not declared in this scope; did you mean 'short'? 18 | sort(ALL(v)); | ^~~~ | short
s122128061
p03938
C++
#include<iostream> using namespace std; const int d = 20100; int main(){ vector<pair<int,int> > v; int N; cin>>N; for(int i=0;i<N;i++){ int p; cin>>p; p--; v.push_back(make_pair(p,i)); } sort(ALL(v)); vector<int> a,b; for(int i=0;i<N;i++){ a[i] = v[i].second; b[i] = 0; a[i] += d*i; b[i] += -d*i + 500000000; } for(int i=0;i<N;i++){ cout<<a[i]<<" "; } cout<<endl; for(int i=0;i<N;i++){ cout<<b[i]<<" "; } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'vector' was not declared in this scope 8 | vector<pair<int,int> > v; | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include<iostream> +++ |+#include <vector> 2 | a.cc:8:30: error: expected primary-expression before '>' token 8 | vector<pair<int,int> > v; | ^ a.cc:8:32: error: 'v' was not declared in this scope 8 | vector<pair<int,int> > v; | ^ a.cc:17:14: error: 'ALL' was not declared in this scope 17 | sort(ALL(v)); | ^~~ a.cc:17:9: error: 'sort' was not declared in this scope; did you mean 'short'? 17 | sort(ALL(v)); | ^~~~ | short a.cc:18:16: error: expected primary-expression before 'int' 18 | vector<int> a,b; | ^~~ a.cc:20:17: error: 'a' was not declared in this scope 20 | a[i] = v[i].second; | ^ a.cc:21:17: error: 'b' was not declared in this scope 21 | b[i] = 0; | ^ a.cc:26:23: error: 'a' was not declared in this scope 26 | cout<<a[i]<<" "; | ^ a.cc:30:23: error: 'b' was not declared in this scope 30 | cout<<b[i]<<" "; | ^
s768597385
p03938
C++
#define DEB #include<bits/stdc++.h> #define REP(i,m) for(int i=0;i<(m);++i) #define REPN(i,m,in) for(int i=(in);i<(m);++i) #define ALL(t) (t).begin(),(t).end() #define CLR(a) memset((a),0,sizeof(a)) #define pb push_back #define mp make_pair #define fr first #define sc second using namespace std; #ifdef DEB #define dump(x) cerr << #x << " = " << (x) << endl #define prl cerr<<"called:"<< __LINE__<<endl template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;} #else #define dump(x) ; #define prl ; template<class T> void debug(T a,T b){ ;} #endif const int MAXN= 201000; int a[MAXN]; int up[MAXN]; int down[MAXN]; int b[MAXN]; int s[MAXN]; int c[MAXN],n; int lowbit(int x)//计算lowbit { return x&(-x); } void add(int i,int val)//将第i个元素更改为val { while(i<=n) { c[i]+=val; i+=lowbit(i); } } int sum(int i)//求前i项和 { int s=0; while(i>0) { s+=c[i]; i-=lowbit(i); } return s; } int main(){ scanf("%d",&n); memset(c,0,sizeof(c)); for(int i=0;i<n;i++){ scanf("%d",&a[i]); int small = sum(a[i]); int big = i - small; //cout<< small << " "<<big<<endl; up[a[i]] = a[i] + small; //cout<< a[i] << " "<<small<<endl; down[a[i]] = n+1-a[i] + big; add(a[i],1); } for(int i=1;i<=n;i++){ if(i!=n) printf("%d ",up[i]); else printf("%d\n",up[i]); } for(int i=1;i<=n;i++){ if(i!=n) printf("%d ",down[i]); else printf("%d\n",down[i]); }
a.cc: In function 'int main()': a.cc:84:5: error: expected '}' at end of input 84 | } | ^ a.cc:59:11: note: to match this '{' 59 | int main(){ | ^
s050953169
p03938
C++
#include <bits/stdc++.h> using namespace std; #define N_PRIME 1000000007 #define ll int64_t int main(void){ int N; cin >> N; vector<int> p; for(int i = 0 ;i < N ; i++ ){ int temp; cin >> temp; temp--; p.push_back(temp); } int a[N]; int b[N]; for(int i = 0 ; i < N ; i++ ){ a[i] = 0; b[i] = 0; } a[ p[0] ] = 0; b[ p[0] ] = 0; for(int i = 0 ; i < p.size() - 1; i++ ){ /* a[p[i]] - a[[p+1]] < b[p[i+1]] - b[p[i]] */ /* p[p+1] > p[i] のとき, */ int sub = p[i+1] - p[i]; if( sub > 0 ){ /* a[p[i]] - a[[p+1]] = -sub < -sub + 1 = b[p[i+1]] - b[p[i]] < 0 */ sub = sub * 1000; a[ p[i+1] ] = a[p[i]] + sub; b[ p[i+1] ] = b[p[i]] - sub + 10; }else{ sub = sub * (-1); sub = sub * 10 00 ; /* 0 < a[p[i]] - a[[p+1]] = sub < sub+1 = b[p[i+1]] - b[p[i]] */ a[ p[i+1] ] = a[p[i]] - sub; b[ p[i+1] ] = b[p[i]] + sub + 10; } } int m = min(a[0],b[N-1]); if( m <= 0 ){ for(int i = 0 ; i < N ; i++ ){ a[i] += -m + 1; b[i] += -m + 1; } } for(int i = 0 ; i < N - 1; i++ ){ cout << a[i] << " "; } cout << a[N-1] << endl; for(int i = 0 ; i < N - 1; i++ ){ cout << b[i] << " "; } cout << b[N-1] << endl; return 0; }
a.cc: In function 'int main()': a.cc:41:27: error: expected ';' before numeric constant 41 | sub = sub * 10 00 ; | ^ ~~ | ;
s289513159
p03938
C++
#include "bits/stdc++.h" using namespace std; //諸機能 #pragma region MACRO #define putans(x) std::cerr << "[ answer ]: " ; cout << (x) << endl #define dputans(x) std::cerr << "[ answer ]: "; cout << setprecision(40) << (double)(x) << endl #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define RREP(i,n,a) for(int i=(int)(n-1); i>= a; i--) #define rep(i,n) REP(i,0,n) #define rrep(i,n) RREP(i,n,0) #define all(a) begin((a)),end((a)) #define mp make_pair #define exist(container, n) ((container).find((n)) != (container).end()) #define equals(a,b) (fabs((a)-(b)) < EPS) #ifdef _DEBUG //ファイルからテストデータを読み込む std::ifstream ifs("data.txt"); #define put ifs >> #else //ジャッジシステムでいい感じにやる #define put cin >> #endif #pragma endregion //デバッグなどの支援 #pragma region CODING_SUPPORT #ifdef _DEBUG #define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; } #define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); } #define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); } #define dbgArray(a,n) {std::cerr << (#a) << "="; rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} #else #define dbg(var0) {} #define dbg2(var0, var1) {} #define dbg3(var0, var1, var2) {} #define dbgArray(a,n) {} #endif #pragma endregion //typedef(書き換える、書き足す可能性ある) #pragma region TYPE_DEF typedef long long ll; typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis; typedef pair<long long, long long> pll; typedef vector<string> vs; typedef vector<int> vi; #pragma endregion //諸々の定数(書き換える可能性ある) #pragma region CONST_VAL #define PI (2*acos(0.0)) #define EPS (1e-10) #define MOD (ll)(1e9 + 7) #define INF (ll)(2*1e9) #pragma endregion int main() { int n; put n; vector<ll> p(n); rep(i, n) put p[i]; vector<ll> a(n),b(n); rep(i, n) { a[i] = i + 1; b[i] = n - i; } rep(i, n) { int k = p[n - 1-i]; int plus = n - 1 - i; dbg(k, plus); REP(j, k - 1, n) { a[j] += plus; } RREP(j,k,0) { b[j] += plus; } //cout << i << endl; //rep(j, n) cout << a[j] << " "; //cout << endl; //rep(j, n) cout << b[j] << " "; //cout << endl; } int amin = a[0] - 1; int bmin = b[n-1] - 1; rep(i, n) { a[i] -= amin; b[i] -= bmin; } rep(i, n-1) cout << a[i] << " "; cout << a[n-1] << endl; rep(i, n-1) cout << b[i] << " " ; cout << b[n-1] << endl; //rep(i, n) { // cout << a[i] + b[i] << " "; //} END: return 0; } //TLEしたらいもす
a.cc:63:28: error: macro "dbg" passed 2 arguments, but takes just 1 63 | dbg(k, plus); | ^ a.cc:31:9: note: macro "dbg" defined here 31 | #define dbg(var0) {} | ^~~ a.cc: In function 'int main()': a.cc:63:17: error: 'dbg' was not declared in this scope 63 | dbg(k, plus); | ^~~
s208529778
p03938
C++
#include <iostream> using namespace std; int n; int p[20000]; int a[20000],b[20000]; void input(){ int x; cin>>n; for(int i=0;i<na;i++){ cin>>x; p[x-1]=i; } } void solve(){ for(int i=0;i<n;i++){ a[i]=(i+1)*30000; b[i]=999999999-(a[i]-p[i]); } } int main() { input(); solve(); for(int i=0;i<n-1;i++){ cout<<a[i]<<" "; } cout<<a[n-1]<<endl; for(int i=0;i<n-1;i++){ cout<<b[i]<<" "; } cout<<b[n-1]<<endl; }
a.cc: In function 'void input()': a.cc:11:23: error: 'na' was not declared in this scope; did you mean 'n'? 11 | for(int i=0;i<na;i++){ | ^~ | n
s630098171
p03938
C++
69 ll diff = cur - (a[i] + b[i]); 70 if(diff < 0){ 71 a[i] -= diff; 72 } 73 else {
a.cc:2:2: error: expected unqualified-id before numeric constant 2 | 69 ll diff = cur - (a[i] + b[i]); | ^~ a.cc:3:2: error: expected unqualified-id before numeric constant 3 | 70 if(diff < 0){ | ^~ a.cc:6:2: error: expected unqualified-id before numeric constant 6 | 73 else { | ^~
s451523386
p03939
C++
include<bits/stdc++.h> using namespace std; double d,x,ans; int n; int main(){ scanf("%d%lf%lf",&n,&x,&d); while(n!=0){ ans+=x+n*d-d/2; x=(n+1.0)/n*x+5*d/(2*n); d=(n+2.0)/n*d; --n; } printf("%.10lf\n",ans); return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<bits/stdc++.h> | ^~~~~~~ a.cc: In function 'int main()': a.cc:6:9: error: 'scanf' was not declared in this scope 6 | scanf("%d%lf%lf",&n,&x,&d); | ^~~~~ a.cc:13:9: error: 'printf' was not declared in this scope 13 | printf("%.10lf\n",ans); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | include<bits/stdc++.h>
s651212785
p03939
C++
1#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e5 + 5; inline int gi() { char c = getchar(); while (c < '0' || c > '9') c = getchar(); int sum = 0; while ('0' <= c && c <= '9') sum = sum * 10 + c - 48, c = getchar(); return sum; } int n; int main() { double d, x; n = gi(); scanf("%lf%lf", &d, &x); double ans = 0; ++n; while ((n--) > 1) { ans += d + (n - 0.5) * x; d = (5 * x + (2 * n + 2) * d) / (2 * n); x = (2 * n + 4) * x / 2 / n; } printf("%.10lf\n", ans); return 0; }
a.cc:1:2: error: stray '#' in program 1 | 1#include <bits/stdc++.h> | ^ a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 1#include <bits/stdc++.h> | ^ a.cc: In function 'int gi()': a.cc:9:18: error: 'getchar' was not declared in this scope 9 | char c = getchar(); | ^~~~~~~ a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | 1#include <bits/stdc++.h> a.cc: In function 'int main()': a.cc:22:9: error: 'scanf' was not declared in this scope 22 | scanf("%lf%lf", &d, &x); | ^~~~~ a.cc:30:9: error: 'printf' was not declared in this scope 30 | printf("%.10lf\n", ans); | ^~~~~~ a.cc:30:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s375417582
p03939
C++
1#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e5 + 5; inline int gi() { char c = getchar(); while (c < '0' || c > '9') c = getchar(); int sum = 0; while ('0' <= c && c <= '9') sum = sum * 10 + c - 48, c = getchar(); return sum; } int n; int main() { double d, x; n = gi(); scanf("%lf%lf", &d, &x); double ans = 0; ++n; while ((n--) > 1) { ans += d + (n - 0.5) * x; d = (5 * x + (2 * n + 2) * d) / (2 * n); x = (2 * n + 4) * x / 2 / n; } printf("%.10lf\n", ans); return 0; }
a.cc:1:2: error: stray '#' in program 1 | 1#include <bits/stdc++.h> | ^ a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 1#include <bits/stdc++.h> | ^ a.cc: In function 'int gi()': a.cc:9:18: error: 'getchar' was not declared in this scope 9 | char c = getchar(); | ^~~~~~~ a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | 1#include <bits/stdc++.h> a.cc: In function 'int main()': a.cc:22:9: error: 'scanf' was not declared in this scope 22 | scanf("%lf%lf", &d, &x); | ^~~~~ a.cc:30:9: error: 'printf' was not declared in this scope 30 | printf("%.10lf\n", ans); | ^~~~~~ a.cc:30:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s268615549
p03939
C++
#include<iostream> #include<algorithm> #include<vector> #include<string> #include<set> #include<queue> #include<stack> #include<bitset> #include<functional> #include<map> #include<iomanip> #include<limits> #include<unordered_set> #include<cmath> #include <numeric> #include <array> #include <complex> double M_PI = 3.1415926535897932384626; using namespace std; //long long p = 998244353; long long p = 1000000007; #define int long long #define vel vector<long long> #define vvel vector<vel> #define rep(i,n) for(int i=0;i<n;i++) #define sor(v) sort(v.begin(),v.end()) #define mmax(a,b) a=max(a,b) #define mmin(a,b) a=min(a,b) #define mkp make_pair #define pin pair<int,int> #define qin pair<pin,int> #define V vector #define Endl endl #define veb vector<bool> #define fcout cout << fixed << setprecision(15) #define rev(s) reverse(s.begin(),s.end()) #define lower(h,val) lower_bound(h.begin(),h.end(),val)-h.begin() #define upper(h,val) upper_bound(h.begin(),h.end(),val)-h.begin() int max_kai = 10000; vel kai(max_kai, 1); vel inv_kai(max_kai, 1); int rui(int a, int n, int mod) { if (n == 0) { return 1 % mod; } int x = rui(a, n / 2, mod); x *= x; x %= mod; if (n % 2 == 1) { x *= a; x %= mod; } return x; } int root(int x,vel &pa) { if (pa[x] == -1) { return x; } int ans = root(pa[x],pa); pa[x] = ans; return ans; } bool mar(int x, int y,vel &pa) { x = root(x,pa); y = root(y,pa); if (x != y) { pa[x] = y; } return (x != y); } int gcd(int x, int y) { if (x < y) { return gcd(y, x); } if (y == 0) { return x; } return gcd(y, x % y); } long long modinv(long long a, long long m) { long long b = m, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } void make_kai() { rep(i, max_kai - 1) { kai[i + 1] = kai[i] * (i + 1); kai[i + 1] %= p; inv_kai[i + 1] = modinv(kai[i + 1], p); } } int com(int n, int r) { if ((n < 0) || (r < 0) || (r > n)) { return 0; } int ans = (kai[n] * inv_kai[r]) % p; return (ans * inv_kai[n - r]) % p; } vel uni(vel x) { if (x.size() == 0) { return x; } sor(x); int n = x.size(); vel ans(1, x[0]); for (int j = 1; j < n; j++) { if (x[j - 1] != x[j]) { ans.push_back(x[j]); } } x = ans; return x; } void pr(vel& v) { int n = v.size(); if (n != 0) { cout << v[0]; rep(i, n - 1) { cout << " " << v[i + 1]; } cout << endl; } } int inf = 100000; vel dijk(V<V<pin>>& way, int st) { int n = way.size(); vel dist(n, inf); dist[st] = 0; priority_queue<pin, vector<pin>, greater<pin>> pq; pq.push(mkp(0, st)); veb is_checked(n, false); while (!pq.empty()) { pin x = pq.top(); pq.pop(); int pot = x.second; if (!is_checked[pot]) { is_checked[pot] = true; for (auto y : way[pot]) { int nex_dist = x.first + y.second; int nex_pot = y.first; if (dist[nex_pot] > nex_dist) { dist[nex_pot] = nex_dist; pq.push(mkp(nex_dist, y.first)); } } } } return dist; } template< typename Monoid > struct SegmentTree { using F = function< Monoid(Monoid, Monoid) >; int sz; vector< Monoid > seg; const F f; const Monoid M1; SegmentTree(int n, const F f, const Monoid& M1) : f(f), M1(M1) { sz = 1; while (sz < n) sz <<= 1; seg.assign(2 * sz, M1); } void set(int k, const Monoid& x) { seg[k + sz] = x; } void build() { for (int k = sz - 1; k > 0; k--) { seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]); } } void update(int k, const Monoid& x) { k += sz; seg[k] = x; while (k >>= 1) { seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]); } } Monoid query(int a, int b) { Monoid L = M1, R = M1; for (a += sz, b += sz; a < b; a >>= 1, b >>= 1) { if (a & 1) L = f(L, seg[a++]); if (b & 1) R = f(seg[--b], R); } return f(L, R); } Monoid operator[](const int& k) const { return seg[k + sz]; } template< typename C > int find_subtree(int a, const C& check, Monoid& M, bool type) { while (a < sz) { Monoid nxt = type ? f(seg[2 * a + type], M) : f(M, seg[2 * a + type]); if (check(nxt)) a = 2 * a + type; else M = nxt, a = 2 * a + 1 - type; } return a - sz; } template< typename C > int find_first(int a, const C& check) { Monoid L = M1; if (a <= 0) { if (check(f(L, seg[1]))) return find_subtree(1, check, L, false); return -1; } int b = sz; for (a += sz, b += sz; a < b; a >>= 1, b >>= 1) { if (a & 1) { Monoid nxt = f(L, seg[a]); if (check(nxt)) return find_subtree(a, check, L, false); L = nxt; ++a; } } return -1; } template< typename C > int find_last(int b, const C& check) { Monoid R = M1; if (b >= sz) { if (check(f(seg[1], R))) return find_subtree(1, check, R, true); return -1; } int a = sz; for (b += sz; a < b; a >>= 1, b >>= 1) { if (b & 1) { Monoid nxt = f(seg[--b], R); if (check(nxt)) return find_subtree(b, check, R, true); R = nxt; } } return -1; } }; vel mul(vel& a, vel& b) { int n = a.size(); int m = b.size(); vel ans(n + m - 1, 0); rep(i, n) { rep(j, m) { ans[i + j] += a[i] * b[j]; ans[i + j] %= p; } } return ans; } vel rui_p(vel& a, int n) { if (n == 0) { return{ 1 }; } vel qans = rui_p(a, n / 2); qans = mul(qans, qans); if (n % 2 == 1) { qans = mul(qans, a); } return qans; } int solve(vel& h) { int n = h.size(); if (n == 0) { return 0; } if (n == 1) { return h[0]; } int mn = h[0]; rep(i, n) { mmin(mn, h[i]); } rep(i, n) { h[i] -= mn; } int ans = mn; vel v; rep(i, n) { if (h[i] == 0) { ans += solve(v); v = {}; } else { v.push_back(h[i]); } } ans += solve(v); return ans; } // Cooley–Tukey FFT algorithm O(N log N) vector<complex<double>> fft(vector<complex<double>> a, bool inverse = false) { int n = a.size(); int h = 0; // h = log_2(n) for (int i = 0; 1 << i < n; i++) h++; // バタフライ演算用の配置入れ替え for (int i = 0; i < n; i++) { int j = 0; for (int k = 0; k < h; k++) j |= (i >> k & 1) << (h - 1 - k); if (i < j) swap(a[i], a[j]); } // バタフライ演算 for (int b = 1; b < n; b *= 2) { // 第 log_2(b) + 1 段 // ブロックサイズ = b * 2 for (int j = 0; j < b; j++) { // ブロック内 j 個目 // 重み w = (1 の原始 2b 乗根の j 乗) complex<double> w = polar(1.0, (2 * M_PI) / (2 * b) * j * (inverse ? 1 : -1)); for (int k = 0; k < n; k += b * 2) { // k を先頭とするブロック complex<double> s = a[j + k]; // 前 complex<double> t = a[j + k + b] * w; // 後 a[j + k] = s + t; // 前の更新 a[j + k + b] = s - t; // 後の更新 } } } // 逆変換時にサイズで割る調整 if (inverse) for (int i = 0; i < n; i++) a[i] /= n; return a; } // Cooley–Tukey FFT algorithm O(N log N) vector<complex<double>> fft(vector<double> a, bool inverse = false) { vector<complex<double>> a_complex(a.size()); for (int i = 0; i < a.size(); i++) a_complex[i] = complex<double>(a[i], 0); return fft(a_complex, inverse); } // FFT による畳み込み O(N log N) vector<double> convolve(vector<double> a, vector<double> b) { int s = a.size() + b.size() - 1; // 畳み込み結果のサイズ int t = 1; // FFT に使う配列のサイズ(2 の累乗) while (t < s) t *= 2; a.resize(t); // FFT するためにリサイズ b.resize(t); // FFT するためにリサイズ vector<complex<double>> A = fft(a); vector<complex<double>> B = fft(b); for (int i = 0; i < t; i++) { A[i] *= B[i]; // 畳み込み結果の FFT 結果を得る } A = fft(A, true); // IFFT で畳み込み結果を得る a.resize(s); // 畳み込み結果を入れるためにリサイズ for (int i = 0; i < s; i++) a[i] = A[i].real(); // 実部が答え return a; } signed main(){ int n; cin >> n; V<double> a(n+1, 0); double now_sum = 0; for(int i=1;i<=n;i++) { now_sum += a[i - 1]; double mi = i; a[i] = 2*now_sum / mi; a[i] += (mi + 1) / 2; } double d1, x; cin >> d1 >> x; d1 += ((2 * n - 1) * x) / 2; fcout << a[n] * d1 << endl; return 0; }
In file included from /usr/include/c++/14/cmath:47, from a.cc:14: a.cc:18:8: error: expected unqualified-id before numeric constant 18 | double M_PI = 3.1415926535897932384626; | ^~~~
s173716483
p03939
C++
#include<bits/stdc++.h> using namespace std; int main() { freopen("1.in","r",stdin); int n;double d,x; cin>>n>>d>>x; double ans=0; for(;n;--n) { ans+=d+(n-0.5)*x; d=((2*n+2)*d+5*x)/(2*n); x=(2*n+4)*x/(2*n); } printf("%.9f\n",ans);
a.cc: In function 'int main()': a.cc:16:26: error: expected '}' at end of input 16 | printf("%.9f\n",ans); | ^ a.cc:5:1: note: to match this '{' 5 | { | ^
s928443169
p03939
C++
#include<bits/stdc++.h> using namespace std; int n; double d,x; int main(){ scanf("%d%d%d",&n,&d,&x); double ans=0; for(;n;--n){ ans+=d+(n-0.5)*x; d=(((n+1)<<1)*d+(x<<1)+(x<<2))/(n<<1); x=((n+2)<<1))*x/(n<<1); } printf("%.9f\n",ans); }
a.cc: In function 'int main()': a.cc:10:35: error: invalid operands of types 'double' and 'int' to binary 'operator<<' 10 | d=(((n+1)<<1)*d+(x<<1)+(x<<2))/(n<<1); | ~^~~ | | | | | int | double a.cc:10:42: error: invalid operands of types 'double' and 'int' to binary 'operator<<' 10 | d=(((n+1)<<1)*d+(x<<1)+(x<<2))/(n<<1); | ~^~~ | | | | | int | double a.cc:11:29: error: expected ';' before ')' token 11 | x=((n+2)<<1))*x/(n<<1); | ^ | ;
s513358875
p03939
C++
#include<bits/stdc++.h> using namespace std; int n; double d,x; int main(){ scanf("%d%d%d",&n,&d,&x); double ans=0; for(;n;--n){ ans+=d+(n-0.5)*x; d=(((n+1)<<1)*d+(x<<1)+(x<<2))/(n<<1); x=((n+2)<<1))*x/(n<<1); } printf("%.9f\n",ans); }
a.cc: In function 'int main()': a.cc:10:35: error: invalid operands of types 'double' and 'int' to binary 'operator<<' 10 | d=(((n+1)<<1)*d+(x<<1)+(x<<2))/(n<<1); | ~^~~ | | | | | int | double a.cc:10:42: error: invalid operands of types 'double' and 'int' to binary 'operator<<' 10 | d=(((n+1)<<1)*d+(x<<1)+(x<<2))/(n<<1); | ~^~~ | | | | | int | double a.cc:11:29: error: expected ';' before ')' token 11 | x=((n+2)<<1))*x/(n<<1); | ^ | ;
s705772827
p03939
C++
Quick and Efficient EDB to PST tool from EdbMails The days of worrying over corrupted Exchange Server databases are long over. EdbMails Exchange Server Recovery tool is here to fix all your EDB issues and retrieve every last bit of data from it. This is designed for quick, efficient and accurate recovery of EDB after events like sudden power failure, accidentally deleted mailboxes and similar scenarios. It supports exchange server versions like 2019,2016,2013,2010,2007 and 2003. For exchange server version 2003,the tool automatically locates the .stm file. The tool is compatible with Windows operating systems like Windows XP, Vista, 7, 8, 8.1 and 10. You can chose to export the EDB file mailbox into single or multiple PST files. There is even brick level recovery option that lets you export only the selected items instead of doing it as a whole. This tool can recover mails,mail attachments,drafts,contacts,calendar,tasks,notes,journals etc. What makes EdbMails a one stop exchange recovery solution is the fact that it can migrate EDB directly to Office 365 or even Live Exchange Server. EdbMails offers support for Public and Private folder recovery and migration as well as archive folder migration. It also has support for Non-English Unicode characters and maintains the folder structure intact post export. The data in the original source EDB file is not altered with in any manner when using EdbMails. There is also support for direct migration to Office 365 and on-premise exchange server. Not only can you Convert EDB to PST using EdbMails, but there is also support for incremental EDB migration to Office 365 and Live Exchange Server. For more information and downloads please visit : https://www.edbmails.com
a.cc:1:1: error: 'Quick' does not name a type 1 | Quick and Efficient EDB to PST tool from EdbMails | ^~~~~
s651513168
p03939
C++
#include <bits/stdc++.h> #define mod 1000000007 #define pb push_back #define ll long long using namespace std; double solve(ll num, double d1, double dif){ if(num == 1) return d1; else{ ll nnum = num-1; double nd1 = (num+1) * d1 / num + 3 * dif / (2 * num); double ndif = (num+2) * dif / num; return ex + solve(nnum, nd1,ndif); } } int main(){ ll n,d,x; cin>>n>>d>>x; double nd = (d + d + x) / 2.0; double nx = x * 2.0; cout<<fixed; cout<<setprecision(12)<<solve(n,nd,nx)<<endl; return 0; }
a.cc: In function 'double solve(long long int, double, double)': a.cc:12:24: error: 'ex' was not declared in this scope; did you mean 'exp'? 12 | return ex + solve(nnum, nd1,ndif); | ^~ | exp
s039538454
p03939
C++
#include <iostream> #include <cstring> #include <string> #include <algorithm> #include <cstdlib> #include <cstdio> #include <map> #include <set> #include <cmath> #include <vector> #include <ctime> #include <Queue> #include <sstream> #include <utility> #include <bitset> #include <stack> using namespace std; #define MP make_pair #define PB push_back #define INF (1000000007) #define eps 1e-8 #define MOD (1000003) #define IOS ios::sync_with_stdio(false) typedef pair<int,int> pii ; typedef pair<double,double> pdd ; typedef long long ll ; ll n,e,t; ll dp[100005],p[100005]; ll mx=1e18; multiset<ll>s; int main() { IOS; cin>>n>>e>>t; for(int i=1;i<=n;i++) cin>>p[i]; dp[0]=0; int pos=0; for(int i=1;i<=n;i++) { s.insert(dp[i-1]); while(pos<=i) { if((p[i]-p[pos])*2>t) { mx=min(dp[pos-1]-p[pos]*2,mx); s.erase(dp[pos-1]); pos++; } else break; } dp[i]=min(*s.begin()+t,mx+2*p[i]); } cout<<dp[n]+e; return 0; }
a.cc:12:10: fatal error: Queue: No such file or directory 12 | #include <Queue> | ^~~~~~~ compilation terminated.
s678489344
p03939
C++
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- int N,D,X; ll T; double F[402020]; void solve() { int i,j,k,l,r,x,y; string s; cin>>N>>D>>X; FOR(i,2*N) { T += D; D += X; } for(x=1;x<=N;x++) { F[x] = 1.0/(2*x) + ((x-1.0)/x)*(1+1.0/x)*F[x-1]; } _P("%.12lf\n",T[2*N]*F[N]); } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); solve(); return 0; }
a.cc: In function 'void solve()': a.cc:33:24: error: invalid types 'll {aka long long int}[int]' for array subscript 33 | _P("%.12lf\n",T[2*N]*F[N]); | ^ a.cc:6:30: note: in definition of macro '_P' 6 | #define _P(...) (void)printf(__VA_ARGS__) | ^~~~~~~~~~~
s552620539
p03940
C++
v#include <iostream> #include <string> #include <vector> #include <queue> #include <deque> #include <stack> #include <set> #include <map> #include <unordered_map> #include <unordered_set> #include <cstring> #include <cmath> #include <cstdlib> #include <algorithm> #include <random> #include <iomanip> #include <functional> #include <cassert> using namespace std; typedef long long ll; const ll Inf = 1e18; int main() { ios_base::sync_with_stdio(false); cin.tie(0); #ifdef LOCAL freopen("input.txt", "r", stdin); #endif int n, e, t; cin >> n >> e >> t; vector <int> x(n + 1); for (int i = 0; i < n; ++i) cin >> x[i + 1]; x[0] = 0; vector <ll> dp(n + 1, Inf); dp[0] = 0; for (int i = 0; i < n; ++i) { ll go = 0; for (int j = i + 1; j <= n; ++j) { go += x[j] - x[j - 1]; dp[j] = min(dp[j], dp[i] + go + (ll)t * (j - i)); ll back = 2 * (go - (x[i + 1] - x[i])); ll extra = max(0LL, t - back); dp[j] = min(dp[j], dp[i] + go + 2 * (go - (x[i + 1] - x[i])) + extra); } } cout << dp[n] + e - x[n] << '\n'; }
a.cc:1:2: error: stray '#' in program 1 | v#include <iostream> | ^ a.cc:1:1: error: 'v' does not name a type 1 | v#include <iostream> | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/char_traits.h:50: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared 144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type 146 | static _GLIBCXX14_CONSTEXPR std::size_t | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared 150 | find(const char_type* __s, std::size_t __n, const char_type& __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared 153 | move(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared 156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared 159 | assign(char_type* __s, std::size_t __n, char_type __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared 187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n) | ^~~ /usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)': /usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~ | __n /usr/include/c++/14/bits/char_traits.h: At global scope: /usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std' does not name a
s346734956
p03940
C++
Name Khoda, Besmellah Rahmane Rahim, In The Name Of God; //#include<bits/stweight++.h> #include<iostream> #include <vector> #include <algorithm> #include <cmath> #include <set> #include <queue> #include <deque> #include <map> #include <stack> #include<bitset> #include<list> #include<cassert> #include<numeric> #include <stdio.h> #include <string.h> #include<iomanip> #include<unordered_map> #include<unordered_set> #include <fstream> using namespace std; const int N = 1e5 + 10; int n, m; bool isVal[N]; vector<int> graph[N]; vector<int> adj[N]; bool mark[N]; int h[N]; int jump[N]; void dfs(int v, int par = -1) { jump[v] = h[v]; mark[v] = true; for (auto u: graph[v]) { if (u == par) { continue; } if (!mark[u]) { h[u] = h[v] + 1; dfs(u, v); jump[v] = min(jump[v], jump[u]); } else { jump[v] = min(jump[v], h[u] - 1); } } } void dfs2(int v) { mark[v] = true; for (auto u: graph[v]) { if (!mark[u] && isVal[u]) { if (isVal[u] && isVal[v]) { adj[u + 1].push_back(v + 1); adj[v + 1].push_back(u + 1); } dfs2(u); } } } int main() { cin >> n >> m; for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; graph[u - 1].push_back(v - 1); graph[v - 1].push_back(u - 1); } for (int i = 0; i < n; i++) { if (!mark[i]) { dfs(i); } } for (int i = 0; i < n; i++) { //cout << i << " " << jump[i] << " " << h[i] << endl;; if (jump[i] >= h[i]) { isVal[i] = true; } } memset(mark, 0, sizeof mark); for (int i = 0; i < n; i++) { if (!mark[i] && isVal[i]) { dfs2(i); adj[0].push_back(i + 1); } } }
a.cc:1:2: error: 'Name' does not name a type 1 | Name Khoda, Besmellah Rahmane Rahim, In The Name Of God; | ^~~~
s793063826
p03940
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; } #define all(x) (x).begin(),(x).end() #define fi first #define se second #define si(x) int(x.size()) const int mod=1000000007,MAX=200005; const ll INF=1LL<<60; ll dp[MAX]; int main(){ std::ifstream in("text.txt"); std::cin.rdbuf(in.rdbuf()); cin.tie(0); ios::sync_with_stdio(false); ll N,E,T;cin>>N>>E>>T; if(N>2000) return 0; vector<ll> A(N); for(int i=0;i<N;i++) cin>>A[i]; A.push_back(0); A.push_back(INF); sort(all(A)); for(int i=1;i<=N+1;i++) dp[i]=INF; dp[0]=0; for(int i=1;i<=N;i++){ auto it=upper_bound(all(A),A[i]+(T+1)/2); chmin(dp[it-A.begin()],dp[i-1]+max((A[it-A.begin()]-A[i])*2,T)); it--; chmin(dp[it-A.begin()],dp[i-1]+max((A[it-A.begin()]-A[i])*2,T)); if(it==A.begin()) continue; it--; chmin(dp[it-A.begin()],dp[i-1]+max((A[it-A.begin()]-A[i])*2,T));*/ } cout<<dp[N]+E<<endl; }
a.cc: In function 'int main()': a.cc:43:74: error: expected primary-expression before '/' token 43 | chmin(dp[it-A.begin()],dp[i-1]+max((A[it-A.begin()]-A[i])*2,T));*/ | ^ a.cc:44:5: error: expected primary-expression before '}' token 44 | } | ^
s954509715
p03940
C++
#include <iostream> #include <algorithm> #include <vector> #include <set> #include <queue> #include <map> #include <string.h> #include <math.h> #include <stdio.h> #include <deque> #include <bits/stdc++.h> //#include "testlib.h" using namespace std; #define ll long long #define pii pair<int,int> #define qi ios::sync_with_stdio(0) bool debug=true; /* ************************************* * Written in New Computer * * The following code belongs to * * XiaoGeNintendo of HellHoleStudios * ************************************* */ template<typename T1,typename T2>ostream& operator<<(ostream& os,pair<T1,T2> ptt){ os<<ptt.first<<","<<ptt.second; return os; } template<typename T>ostream& operator<<(ostream& os,vector<T> vt){ os<<"{"; for(int i=0;i<vt.size();i++){ os<<vt[i]<<" "; } os<<"}"; return os; } ll n,t,e; ll dp[100005]; ll x[100005]; int main(int argc,char* argv[]){ qi; cin>>n>>e>>t; for(int i=0;i<n;i++){ cin>>x[i]; } //dp[i]=min{dp[j]+max{t,2*(x[i]-x[j])}} //dp[i]=min{dp[j]+2*(x[i]-x[j])} or dp[i]=min{dp[j]+t} <-easy //dp[i]=2*x[i]+min{dp[j]-2*x[j])} ll last=0,mn=-2*x[0]; for(int i=0;i<n;i++){ if(2*(x[i]-x[0])<=t){ dp[i]=t; continue; } while(2*(x[i]-x[last+1])>t){ mn=min(mn,dp[last]-2*x[last+1]); last++; } dp[i]=min(mn+2*x[i],dp[last]+t); } cout<<dp[n-1]+e<<endl; return 0; } #include <iostream> #include <algorithm> #include <vector> #include <set> #include <queue> #include <map> #include <string.h> #include <math.h> #include <stdio.h> #include <deque> #include <bits/stdc++.h> //#include "testlib.h" using namespace std; #define ll long long #define pii pair<int,int> #define qi ios::sync_with_stdio(0) bool debug=true; /* ************************************* * Written in New Computer * * The following code belongs to * * XiaoGeNintendo of HellHoleStudios * ************************************* */ template<typename T1,typename T2>ostream& operator<<(ostream& os,pair<T1,T2> ptt){ os<<ptt.first<<","<<ptt.second; return os; } template<typename T>ostream& operator<<(ostream& os,vector<T> vt){ os<<"{"; for(int i=0;i<vt.size();i++){ os<<vt[i]<<" "; } os<<"}"; return os; } ll n,t,e; ll dp[100005]; ll x[100005]; int main(int argc,char* argv[]){ qi; cin>>n>>e>>t; for(int i=0;i<n;i++){ cin>>x[i]; } //dp[i]=min{dp[j]+max{t,2*(x[i]-x[j])}} //dp[i]=min{dp[j]+2*(x[i]-x[j])} or dp[i]=min{dp[j]+t} <-easy //dp[i]=2*x[i]+min{dp[j]-2*x[j])} ll last=0,mn=-2*x[0]; for(int i=0;i<n;i++){ if(2*(x[i]-x[0])<=t){ dp[i]=t; continue; } while(2*(x[i]-x[last+1])>t){ mn=min(mn,dp[last]-2*x[last+1]); last++; } dp[i]=min(mn+2*x[i],dp[last]+t); } cout<<dp[n-1]+e<<endl; return 0; }
a.cc:88:6: error: redefinition of 'bool debug' 88 | bool debug=true; | ^~~~~ a.cc:18:6: note: 'bool debug' previously defined here 18 | bool debug=true; | ^~~~~ a.cc:96:43: error: redefinition of 'template<class T1, class T2> std::ostream& operator<<(std::ostream&, std::pair<_T1, _T2>)' 96 | template<typename T1,typename T2>ostream& operator<<(ostream& os,pair<T1,T2> ptt){ | ^~~~~~~~ a.cc:26:43: note: 'template<class T1, class T2> std::ostream& operator<<(std::ostream&, std::pair<_T1, _T2>)' previously declared here 26 | template<typename T1,typename T2>ostream& operator<<(ostream& os,pair<T1,T2> ptt){ | ^~~~~~~~ a.cc:100:30: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, std::vector<_Tp>)' 100 | template<typename T>ostream& operator<<(ostream& os,vector<T> vt){ | ^~~~~~~~ a.cc:30:30: note: 'template<class T> std::ostream& operator<<(std::ostream&, std::vector<_Tp>)' previously declared here 30 | template<typename T>ostream& operator<<(ostream& os,vector<T> vt){ | ^~~~~~~~ a.cc:109:4: error: redefinition of 'long long int n' 109 | ll n,t,e; | ^ a.cc:39:4: note: 'long long int n' previously declared here 39 | ll n,t,e; | ^ a.cc:109:6: error: redefinition of 'long long int t' 109 | ll n,t,e; | ^ a.cc:39:6: note: 'long long int t' previously declared here 39 | ll n,t,e; | ^ a.cc:109:8: error: redefinition of 'long long int e' 109 | ll n,t,e; | ^ a.cc:39:8: note: 'long long int e' previously declared here 39 | ll n,t,e; | ^ a.cc:110:4: error: redefinition of 'long long int dp [100005]' 110 | ll dp[100005]; | ^~ a.cc:40:4: note: 'long long int dp [100005]' previously declared here 40 | ll dp[100005]; | ^~ a.cc:111:4: error: redefinition of 'long long int x [100005]' 111 | ll x[100005]; | ^ a.cc:41:4: note: 'long long int x [100005]' previously declared here 41 | ll x[100005]; | ^ a.cc:112:5: error: redefinition of 'int main(int, char**)' 112 | int main(int argc,char* argv[]){ | ^~~~ a.cc:42:5: note: 'int main(int, char**)' previously defined here 42 | int main(int argc,char* argv[]){ | ^~~~
s690513520
p03940
C++
// Code by H~$~C #include <bits/stdc++.h> using namespace std; static const int Maxn = 100005; #define int long long int n; long long T, E; long long a[Maxn]; long long dp[Maxn]; // dp[i] = min { dp[j] + a[i] - a[j] + max(T, 2 * (a[i] - a[j + 1]) } // dpt[i] = min { dpt[j] + max(T, 2 * (a[i] - a[j + 1])) } // dp[i] = dpt[i] + a[i] // Ans = dp[n] + (E - a[n]) = dpt[n] + E namespace sgt1 { #define ls (p * 2 + 1) #define rs (p * 2 + 2) #define mid (l + r >> 1) long long tr[Maxn << 2]; inline void init() { memset(tr, 0x3f, sizeof(tr)); } inline void pushup(int p) { tr[p] = min(tr[ls], tr[rs]); } void modify(int p, int l, int r, int pos, long long val) { if (l == r) { tr[p] = min(tr[p], val); return ; } if (pos <= mid) { modify(ls, l, mid, pos, val); } else { modify(rs, mid + 1, r, pos, val); } } long long query(int p, int l, int r, int L, int R) { if (L > r || l > R) return 1e18; if (L <= l && r <= R) { return tr[p]; } long long left = query(ls, l, mid, L, R); long long right = query(rs, mid + 1, r, L, R); return min(left, right); } #undef ls #undef rs #undef mid } namespace sgt2 { #define ls (p * 2 + 1) #define rs (p * 2 + 2) #define mid (l + r >> 1) long long tr[Maxn << 2]; inline void init() { memset(tr, 0x3f, sizeof(tr)); } inline void pushup(int p) { tr[p] = min(tr[ls], tr[rs]); } void modify(int p, int l, int r, int pos, long long val) { if (l == r) { tr[p] = min(tr[p], val); return ; } if (pos <= mid) { modify(ls, l, mid, pos, val); } else { modify(rs, mid + 1, r, pos, val); } } long long query(int p, int l, int r, int L, int R) { if (L > r || l > R) return 1e18; if (L <= l && r <= R) { return tr[p]; } long long left = query(ls, l, mid, L, R); long long right = query(rs, mid + 1, r, L, R); return min(left, right); } #undef ls #undef rs #undef mid } signed main() { scanf("%lld%lld%lld", &n, &E, &T); for (int i = 1; i <= n; ++i) { scanf("%lld", a + i); } memset(dp, 63, sizeof(dp)); dp[0] = 0; sgt1::init(); sgt2::init(); sgt1::modify(0, 0, n, 0, dp[0]); sgt2::modify(0, 0, n, 0, dp[0] - 2 * a[1]); for (int i = 1; i <= n; ++i) { int low = 0, high = i; while (high - low > 1) { int mid = low + high >> 1; if ((a[i] - a[mid]) * 2 > T) L = mid; else R = mid; } int pos = low; if (pos < i) { dp[i] = min(dp[i], sgt1::query(0, 0, n, pos, i - 1) + T); } if (pos > 0) { dp[i] = min(dp[i], sgt2::query(0, 0, n, 0, pos - 1) + 2 * a[i]); } sgt1::modify(0, 0, n, i, dp[i]); sgt2::modify(0, 0, n, i, dp[i] - 2 * a[i + 1]); } printf("%lld\n", dp[n] + E); return 0; }
a.cc: In function 'int main()': a.cc:107:36: error: 'L' was not declared in this scope 107 | if ((a[i] - a[mid]) * 2 > T) L = mid; | ^ a.cc:108:12: error: 'R' was not declared in this scope 108 | else R = mid; | ^
s954793126
p03940
C++
// Code by H~$~C #include <bits/stdc++.h> using namespace std; static const int Maxn = 100005; #define int long long int n; long long T, E; long long a[Maxn]; long long dp[Maxn]; // dp[i] = min { dp[j] + a[i] - a[j] + max(T, 2 * (a[i] - a[j + 1]) } // dpt[i] = min { dpt[j] + max(T, 2 * (a[i] - a[j + 1])) } // dp[i] = dpt[i] + a[i] // Ans = dp[n] + (E - a[n]) = dpt[n] + E namespace sgt1 { #define ls (p * 2 + 1) #define rs (p * 2 + 2) #define mid (l + r >> 1) long long tr[Maxn << 2]; inline void init() { memset(tr, 0x3f, sizeof(tr)); } inline void pushup(int p) { tr[p] = min(tr[ls], tr[rs]); } void modify(int p, int l, int r, int pos, long long val) { if (l == r) { tr[p] = min(tr[p], val); return ; } if (pos <= mid) { modify(ls, l, mid, pos, val); } else { modify(rs, mid + 1, r, pos, val); } } long long query(int p, int l, int r, int L, int R) { if (L > r || l > R) return 1e18; if (L <= l && r <= R) { return tr[p]; } long long left = query(ls, l, mid, L, R); long long right = query(rs, mid + 1, r, L, R); return min(left, right); } #undef ls #undef rs #undef mid } namespace sgt2 { #define ls (p * 2 + 1) #define rs (p * 2 + 2) #define mid (l + r >> 1) long long tr[Maxn << 2]; inline void init() { memset(tr, 0x3f, sizeof(tr)); } inline void pushup(int p) { tr[p] = min(tr[ls], tr[rs]); } void modify(int p, int l, int r, int pos, long long val) { if (l == r) { tr[p] = min(tr[p], val); return ; } if (pos <= mid) { modify(ls, l, mid, pos, val); } else { modify(rs, mid + 1, r, pos, val); } } long long query(int p, int l, int r, int L, int R) { if (L > r || l > R) return 1e18; if (L <= l && r <= R) { return tr[p]; } long long left = query(ls, l, mid, L, R); long long right = query(rs, mid + 1, r, L, R); return min(left, right); } #undef ls #undef rs #undef mid } signed main() { scanf("%lld%lld%lld", &n, &E, &T); for (int i = 1; i <= n; ++i) { scanf("%lld", a + i); } memset(dp, 63, sizeof(dp)); dp[0] = 0; sgt1::init(); sgt2::init(); sgt1::modify(0, 0, n, 0, dp[0]); sgt2::modify(0, 0, n, 0, dp[0] - 2 * a[1]); for (int i = 1; i <= n; ++i) { int low = 0, high = i; while (high - low > 1) { int mid = low + high >> 1; if ((a[i] - a[mid]) * 2 > T) L = mid; else R = mid; } int pos = L; if (pos < i) { dp[i] = min(dp[i], sgt1::query(0, 0, n, pos, i - 1) + T); } if (pos > 0) { dp[i] = min(dp[i], sgt2::query(0, 0, n, 0, pos - 1) + 2 * a[i]); } sgt1::modify(0, 0, n, i, dp[i]); sgt2::modify(0, 0, n, i, dp[i] - 2 * a[i + 1]); } printf("%lld\n", dp[n] + E); return 0; }
a.cc: In function 'int main()': a.cc:107:36: error: 'L' was not declared in this scope 107 | if ((a[i] - a[mid]) * 2 > T) L = mid; | ^ a.cc:108:12: error: 'R' was not declared in this scope 108 | else R = mid; | ^ a.cc:110:15: error: 'L' was not declared in this scope 110 | int pos = L; | ^
s853012626
p03940
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll read(){ ll a=0,b=getchar(),c=1; while(!isdigit(b))c=b=='-'?-1:1,b=getchar(); while(isdigit(b))a=a*10+b-'0',b=getchar(); return a*c; } ll n,t,e,x,ab,a[200005],dp[200005]; int main(){ n=read(),e=read(),t=read(); for(int i=1;i<=n;i++) a[i]=read(); a[n+1]=e; for(int i=1;i<=n;i++){ while((s[i]-s[ab+1])*2>t) x=min(x,dp[ab]-2*s[ab+1]),ab++; dp[i]=min((ll)(1e18),dp[ab]+t); if(ab)dp[i]=min(dp[i],2*s[i]+x); } printf("%lld",dp[n]+e); return 0; }
a.cc: In function 'int main()': a.cc:17:24: error: 's' was not declared in this scope 17 | while((s[i]-s[ab+1])*2>t) | ^ a.cc:20:41: error: 's' was not declared in this scope 20 | if(ab)dp[i]=min(dp[i],2*s[i]+x); | ^
s109218259
p03940
C++
#include<bits/stdc++.h> #define int long long using namespace std; const int maxn=1e6+10; pair<long long int,int>seg[4*maxn]; pair<long long int,int>seg2[4*maxn]; int a[maxn]; long long int dp[2][maxn]; int n; int e; int d; void update(int id,int l,int r,int l2,int r2,long long int val){ if(l>=r2||r<=l2){ return; } if(l2<=l&&r<=r2&&r-l==1){ seg[id]={val,l2}; return ; } int mid=(l+r)>>1; update(id<<1,l,mid,l2,r2,val); update((id<<1)|1,mid,r,l2,r2,val); seg[id]=min(seg[id<<1],seg[(id<<1)|1]); } pair<long long int,int>get(int id,int l,int r,int l2,int r2){ if(l>=r2||r<=l2){ return {(long long int)1e18+10,100000}; } if(l2<=l&&r<=r2){ return seg[id]; } int mid=(l+r)>>1; return min(get(id<<1,l,mid,l2,r2),get((id<<1)|1,mid,r,l2,r2)); } void update2(int id,int l,int r,int l2,int r2,long long int val){ if(l>=r2||r<=l2){ return; } if(l2<=l&&r<=r2&&r-l==1){ seg2[id]={val,l2}; return ; } int mid=(l+r)>>1; update2(id<<1,l,mid,l2,r2,val); update2((id<<1)|1,mid,r,l2,r2,val); seg2[id]=min(seg2[id<<1],seg2[(id<<1)|1]); } pair<long long int,int>get2(int id,int l,int r,int l2,int r2){ if(l>=r2||r<=l2){ return {(long long int)1e18+10,100000}; } if(l2<=l&&r<=r2){ return seg2[id]; } int mid=(l+r)>>1; return min(get2(id<<1,l,mid,l2,r2),get2((id<<1)|1,mid,r,l2,r2)); } inline void input(); int32_t main(){ ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); input(); } inline void input(){ cin>>n>>e>>d; for(int i=0;i<n;i++){ cin>>a[i]; } for(int i=0;i<4*maxn;i++){ seg[i]={(long long)1e18,(int)1e9}; seg2[i]={(long long)1e18,(int)1e9}; } for(int i=0;i<n;i++){ if(i==0){ dp[0][i]=a[i]; dp[1][i]=a[i]; dp[1][i]+=d; } else{ int l=0; int r=i; while(l!=r-1){ int mid=(l+r)>>1; if(2*(a[i]-a[mid])>=d){ l=mid; } else{ r=mid; } } if(2*(a[i]-a[0])<d){ r=0; } if(2*(a[i]-a[i-1])>=d){ l=i-1; } // cout<<l<<": "<<r<<" "<<i<<endl; pair<long long int,int>p=get(1,0,n,0,l+1); //cout<<l<<endl; pair<long long int,int>w=get2(1,0,n,r,i); dp[0][i]=dp[1][i-1]+(a[i]-a[i-1]); dp[1][i]=(long long int)1e18+10; if(2*(a[i]-a[0])>=d){ dp[1][i]=(dp[0][p.second]+1ll*3*(a[i]-a[p.second])); } if(2*(a[i]-a[i-1])<d){ dp[1][i]=min(dp[1][i],(long long)(dp[0][w.second]+d+1ll*2*(a[i]-a[w.second]))); } if(dp[1][i-1]+a[i]-a[i-1]+d<=dp[1][i]){ dp[1][i]=(long long)(dp[1][i-1]+a[i]-a[i-1]+d); } } // cout<<dp[0][i]<<" "<<dp[1][i]<<endl; //cout<<i<<endl; update(1,0,n,i,i+1,(long long)(dp[0][i]+1ll*3*(e-a[i]))); update2(1,0,n,i,i+1,(long long)(dp[0][i]+1ll*2*(e-a[i]))); } cout<<dp[1][n-1]+(e-a[n-1]); }
a.cc:2:13: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:5:16: note: in expansion of macro 'int' 5 | pair<long long int,int>seg[4*maxn]; | ^~~ a.cc:2:18: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:5:16: note: in expansion of macro 'int' 5 | pair<long long int,int>seg[4*maxn]; | ^~~ a.cc:2:13: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:6:16: note: in expansion of macro 'int' 6 | pair<long long int,int>seg2[4*maxn]; | ^~~ a.cc:2:18: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:6:16: note: in expansion of macro 'int' 6 | pair<long long int,int>seg2[4*maxn]; | ^~~ a.cc:2:13: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:8:11: note: in expansion of macro 'int' 8 | long long int dp[2][maxn]; | ^~~ a.cc:2:18: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:8:11: note: in expansion of macro 'int' 8 | long long int dp[2][maxn]; | ^~~ a.cc:2:13: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:12:56: note: in expansion of macro 'int' 12 | void update(int id,int l,int r,int l2,int r2,long long int val){ | ^~~ a.cc:2:18: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:12:56: note: in expansion of macro 'int' 12 | void update(int id,int l,int r,int l2,int r2,long long int val){ | ^~~ a.cc:2:13: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:25:16: note: in expansion of macro 'int' 25 | pair<long long int,int>get(int id,int l,int r,int l2,int r2){ | ^~~ a.cc:2:18: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:25:16: note: in expansion of macro 'int' 25 | pair<long long int,int>get(int id,int l,int r,int l2,int r2){ | ^~~ a.cc: In function 'std::pair<long long int, long long int> get(long long int, long long int, long long int, long long int, long long int)': a.cc:2:13: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:27:36: note: in expansion of macro 'int' 27 | return {(long long int)1e18+10,100000}; | ^~~ a.cc:2:18: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:27:36: note: in expansion of macro 'int' 27 | return {(long long int)1e18+10,100000}; | ^~~ a.cc: At global scope: a.cc:2:13: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:35:57: note: in expansion of macro 'int' 35 | void update2(int id,int l,int r,int l2,int r2,long long int val){ | ^~~ a.cc:2:18: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:35:57: note: in expansion of macro 'int' 35 | void update2(int id,int l,int r,int l2,int r2,long long int val){ | ^~~ a.cc:2:13: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:48:16: note: in expansion of macro 'int' 48 | pair<long long int,int>get2(int id,int l,int r,int l2,int r2){ | ^~~ a.cc:2:18: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:48:16: note: in expansion of macro 'int' 48 | pair<long long int,int>get2(int id,int l,int r,int l2,int r2){ | ^~~ a.cc: In function 'std::pair<long long int, long long int> get2(long long int, long long int, long long int, long long int, long long int)': a.cc:2:13: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:50:36: note: in expansion of macro 'int' 50 | return {(long long int)1e18+10,100000}; | ^~~ a.cc:2:18: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:50:36: note: in expansion of macro 'int' 50 | return {(long long int)1e18+10,100000}; | ^~~ a.cc: In function 'void input()': a.cc:2:13: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:97:32: note: in expansion of macro 'int' 97 | pair<long long int,int>p=get(1,0,n,0,l+1); | ^~~ a.cc:2:18: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:97:32: note: in expansion of macro 'int' 97 | pair<long long int,int>p=get(1,0,n,0,l+1); | ^~~ a.cc:2:13: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:99:32: note: in expansion of macro 'int' 99 | pair<long long int,int>w=get2(1,0,n,r,i); | ^~~ a.cc:2:18: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:99:32: note: in expansion of macro 'int' 99 | pair<long long int,int>w=get2(1,0,n,r,i); | ^~~ a.cc:2:13: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:101:37: note: in expansion of macro 'int' 101 | dp[1][i]=(long long int)1e18+10; | ^~~ a.cc:2:18: error: 'long long long' is too long for GCC 2 | #define int long long | ^~~~ a.cc:101:37: note: in expansion of macro 'int' 101 | dp[1][i]=(long long int)1e18+10; | ^~~
s506449694
p03940
C++
#include<bits/stdc++.h> using namespace std; using ll=long long; const ll INF=1e18; int main(){ int n; cin>>n; ll t,e; cin>>e>>t; vector<ll> x(n+1); for(int i=1;i<=n;i++) cin>>x[i]; vector<ll> dp(n+1); multiset<ll> As; multiset<ll> Bs; vector<ll> A(n); vector<ll> B(n); auto calcA=[&](int i){ return dp[i]-2*x[i+1]-x[i]; }; auto calcB=[&](int i){ return dp[i]-x[i]; }; A[0]=calcA(0),B[0]=calcB(0); Bs.insert(B[0]); int iter=0; for(int i=1;i<=n;i++){ while(iter<i && 2*(x[i]-x[iter+1])>=t){ As.insert(A[iter]); Bs.erase(Bs.find(B[iter])); iter++; } ll vX=(As.empty() ? INF : *As.begin()+3*x[i]); ll vY=(Bs.empty() ? INF : *Bs.begin()+x[i]+t); dp[i]=min(vX,vY); if(i==n) break; A[i]=calcA(i),B[i]=calcB(i); Bs.insert(B[i]); } cout<<e-x[n]+dp[n]<<endl; return 0; }#include<bits/stdc++.h> using namespace std; using ll=long long; const ll INF=1e18; int main(){ int n; cin>>n; ll t,e; cin>>e>>t; vector<ll> x(n+1); for(int i=1;i<=n;i++) cin>>x[i]; vector<ll> dp(n+1); multiset<ll> As; multiset<ll> Bs; vector<ll> A(n); vector<ll> B(n); auto calcA=[&](int i){ return dp[i]-2*x[i+1]-x[i]; }; auto calcB=[&](int i){ return dp[i]-x[i]; }; A[0]=calcA(0),B[0]=calcB(0); Bs.insert(B[0]); int iter=0; for(int i=1;i<=n;i++){ while(iter<i && 2*(x[i]-x[iter+1])>=t){ As.insert(A[iter]); Bs.erase(Bs.find(B[iter])); iter++; } ll vX=(As.empty() ? INF : *As.begin()+3*x[i]); ll vY=(Bs.empty() ? INF : *Bs.begin()+x[i]+t); dp[i]=min(vX,vY); if(i==n) break; A[i]=calcA(i),B[i]=calcB(i); Bs.insert(B[i]); } cout<<e-x[n]+dp[n]<<endl; return 0; }
a.cc:43:2: error: stray '#' in program 43 | }#include<bits/stdc++.h> | ^ a.cc:43:3: error: 'include' does not name a type 43 | }#include<bits/stdc++.h> | ^~~~~~~ a.cc:47:10: error: redefinition of 'const ll INF' 47 | const ll INF=1e18; | ^~~ a.cc:5:10: note: 'const ll INF' previously defined here 5 | const ll INF=1e18; | ^~~ a.cc:48:5: error: redefinition of 'int main()' 48 | int main(){ | ^~~~ a.cc:6:5: note: 'int main()' previously defined here 6 | int main(){ | ^~~~
s097296480
p03940
C++
#include <bits/stdc++.h> using namespace std; long long maxn=(1ll<<63-1); long long a[10001],dp[10001]={0}; long long n,e,t,k=0; int main() { memset(dp,0x3f3f3f3f,sizeof(dp)); cin>>n>>e>>t; for(int i=1;i<=n;i++) scanf("%d",&a[i]); for(int i=1;i<=n;i++) { while(t<=2*(a[i]-a[k+1])) { maxn=min(maxn,dp[k]-2*a[k+1]); k++; } dp[i]=dp[k]+t; dp[i]=min(dp[i],maxn+2*a[i]); } dp[n]+=e; cout<<dp[n]<<endl; }#include<bits/stdc++.h> using namespace std; long long inf=(1ll<<63-1); long long a[10005],dp[1005]; long long n,e,t,maxn=inf; int main() { memset(dp,(ll)0x3f3f3f3f,sizeof(dp)); cin>>n>>e>>t; for(int i=1;i<=n;i++) cin>>a[i]; dp[0]=0; int t=0; for(int i=1;i<=n;i++) { while(t<=2*(a[i]-a[t+1])) { maxn=min(maxn,dp[t]-2*a[t+1]); t++; } dp[i]=dp[t]+t; dp[i]=min(dp[i],maxn+2*a[i]); } dp[n]+=e; cout<<dp[n]<<endl; }
a.cc:24:2: error: stray '#' in program 24 | }#include<bits/stdc++.h> | ^ a.cc:24:3: error: 'include' does not name a type 24 | }#include<bits/stdc++.h> | ^~~~~~~ a.cc:27:11: error: conflicting declaration 'long long int a [10005]' 27 | long long a[10005],dp[1005]; | ^ a.cc:4:11: note: previous declaration as 'long long int a [10001]' 4 | long long a[10001],dp[10001]={0}; | ^ a.cc:27:20: error: conflicting declaration 'long long int dp [1005]' 27 | long long a[10005],dp[1005]; | ^~ a.cc:4:20: note: previous declaration as 'long long int dp [10001]' 4 | long long a[10001],dp[10001]={0}; | ^~ a.cc:28:11: error: redefinition of 'long long int n' 28 | long long n,e,t,maxn=inf; | ^ a.cc:5:11: note: 'long long int n' previously declared here 5 | long long n,e,t,k=0; | ^ a.cc:28:13: error: redefinition of 'long long int e' 28 | long long n,e,t,maxn=inf; | ^ a.cc:5:13: note: 'long long int e' previously declared here 5 | long long n,e,t,k=0; | ^ a.cc:28:15: error: redefinition of 'long long int t' 28 | long long n,e,t,maxn=inf; | ^ a.cc:5:15: note: 'long long int t' previously declared here 5 | long long n,e,t,k=0; | ^ a.cc:28:17: error: redefinition of 'long long int maxn' 28 | long long n,e,t,maxn=inf; | ^~~~ a.cc:3:11: note: 'long long int maxn' previously defined here 3 | long long maxn=(1ll<<63-1); | ^~~~ a.cc:29:5: error: redefinition of 'int main()' 29 | int main() | ^~~~ a.cc:6:5: note: 'int main()' previously defined here 6 | int main() | ^~~~ a.cc: In function 'int main()': a.cc:31:20: error: 'll' was not declared in this scope 31 | memset(dp,(ll)0x3f3f3f3f,sizeof(dp)); | ^~
s210815583
p03940
C++
#include<bits/stdc++.h> long long n,E,T,t,a[100005],f[100005],M=1LL<<60;int main(){scanf("%d%d%d",&n,&E,&T);for(int i=1;i<=n;i++)scanf("%d",&a[i]);for(int i=1;i<=n;i++){for (;T<=2*(a[i]-a[t+1]);t++)M=__min(M,f[t]-2*a[t+1]);f[i]=__min(f[t]+T,M+2*a[i]);}printf("%lld",E+f[n]);}
a.cc: In function 'int main()': a.cc:2:177: error: '__min' was not declared in this scope; did you mean '__sin'? 2 | long long n,E,T,t,a[100005],f[100005],M=1LL<<60;int main(){scanf("%d%d%d",&n,&E,&T);for(int i=1;i<=n;i++)scanf("%d",&a[i]);for(int i=1;i<=n;i++){for (;T<=2*(a[i]-a[t+1]);t++)M=__min(M,f[t]-2*a[t+1]);f[i]=__min(f[t]+T,M+2*a[i]);}printf("%lld",E+f[n]);} | ^~~~~ | __sin a.cc:2:205: error: '__min' was not declared in this scope; did you mean '__sin'? 2 | long long n,E,T,t,a[100005],f[100005],M=1LL<<60;int main(){scanf("%d%d%d",&n,&E,&T);for(int i=1;i<=n;i++)scanf("%d",&a[i]);for(int i=1;i<=n;i++){for (;T<=2*(a[i]-a[t+1]);t++)M=__min(M,f[t]-2*a[t+1]);f[i]=__min(f[t]+T,M+2*a[i]);}printf("%lld",E+f[n]);} | ^~~~~ | __sin
s363727182
p03940
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll n, e, t; cin>>n>>e>>t; if(n > 2004) return; ll a[n]; for(int i = 0; i < n; i++) cin>>a[i]; ll dp[n+1]; dp[n] = 0; for(int i = n-1; i >= 0; i--){ dp[i] = dp[i+1] + t; for(int j = i+1; j < n; j++){ dp[i] = min(dp[i], dp[j+1] + max(2*(a[j]-a[i]), t)); } } cout<<dp[0] + e<<endl; }
a.cc: In function 'int main()': a.cc:7:22: error: return-statement with no value, in function returning 'int' [-fpermissive] 7 | if(n > 2004) return; | ^~~~~~
s810769784
p03940
C++
#include<bits/stdc++.h> using namespace std; template<typename t>void chkmin(t&a,t b){if(a>b)a=b;} typedef long long ll; const int maxn=1e5+10; int n,t,e,x[maxn],end=0; ll dp[maxn],val=1e18; int main(){ cin>>n>>e>>t; for(int i=1;i<=n;++i){ dp[i]=1e18; cin>>x[i]; while(end<i&&2*(x[i]-x[end+1])>=t) chkmin(val,dp[end]-2*x[end+1]),++end; chkmin(dp[i],val+2*x[i]); if(end<i) chkmin(dp[i],dp[end]+t); } printf("%lld\n",dp[n]+e); return 0; }
a.cc: In function 'int main()': a.cc:16:23: error: reference to 'end' is ambiguous 16 | while(end<i&&2*(x[i]-x[end+1])>=t) | ^~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166, from a.cc:1: /usr/include/c++/14/valarray:1265:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ In file included from /usr/include/c++/14/string:53, 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/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ In file included from /usr/include/c++/14/bits/algorithmfwd.h:39, from /usr/include/c++/14/bits/stl_algo.h:59, from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ a.cc:8:19: note: 'int end' 8 | int n,t,e,x[maxn],end=0; | ^~~ a.cc:16:40: error: reference to 'end' is ambiguous 16 | while(end<i&&2*(x[i]-x[end+1])>=t) | ^~~ /usr/include/c++/14/valarray:1265:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ a.cc:8:19: note: 'int end' 8 | int n,t,e,x[maxn],end=0; | ^~~ a.cc:17:39: error: reference to 'end' is ambiguous 17 | chkmin(val,dp[end]-2*x[end+1]),++end; | ^~~ /usr/include/c++/14/valarray:1265:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ a.cc:8:19: note: 'int end' 8 | int n,t,e,x[maxn],end=0; | ^~~ a.cc:17:48: error: reference to 'end' is ambiguous 17 | chkmin(val,dp[end]-2*x[end+1]),++end; | ^~~ /usr/include/c++/14/valarray:1265:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ a.cc:8:19: note: 'int end' 8 | int n,t,e,x[maxn],end=0; | ^~~ a.cc:17:58: error: reference to 'end' is ambiguous 17 | chkmin(val,dp[end]-2*x[end+1]),++end; | ^~~ /usr/include/c++/14/valarray:1265:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ a.cc:8:19: note: 'int end' 8 | int n,t,e,x[maxn],end=0; | ^~~ a.cc:19:20: error: reference to 'end' is ambiguous 19 | if(end<i) | ^~~ /usr/include/c++/14/valarray:1265:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ a.cc:8:19: note: 'int end' 8 | int n,t,e,x[maxn],end=0; | ^~~ a.cc:20:41: error: reference to 'end' is ambiguous 20 | chkmin(dp[i],dp[end]+t); | ^~~ /usr/include/c++/14/valarray:1265:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va)
s902804088
p03940
C++
#include <bits/stdc++.h> using namespace std; #define FOR(i,a,b) for (int i = (a); i < (b); i++) #define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--) #define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++) #define FILL(a,value) memset(a, value, sizeof(a)) #define SZ(a) (int)a.size() #define ALL(a) a.begin(), a.end() #define pb push_back #define mp make_pair typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; const double PI = acos(-1.0); const int INF = 1000 * 1000 * 1000 + 7; const ll LINF = INF * (ll) INF; ll dp[100001]; int N , E , T; int a[100001]; ll dpRMQ[100001]; int opt = 0; ll cost(int i , int opt) { ll prev = 0; prev = dp[opt - 1]; ll cur = max((a[i] - a[opt]) * 2 , T); return prev + cur; } int findOpt(int idx) { return lower_bound(a , a + N , a[idx] - T / 2) - a; } ll findDp(int idx) { int opt = findOpt(idx); //cout << opt << endl; ll dp1 = T; if(opt - 1 >= 0) dp1 += dp[opt - 1]; ll dp2 = a[idx] * 2; if(opt - 1 >= 0) dp2 += min(dpRMQ[opt - 1] , 0); //cout << dp1 << " " << dp2 << endl; //if(opt < idx) return(min(dp1 , dp2)); //else //return dp2; } int main() { scanf("%d %d %d" , &N , &E , &T); for(int i = 0; i < N; i++) { scanf("%d" , &a[i]); } dp[0] = T; dpRMQ[0] = - a[0] * 2; for(int i = 1; i < N; i++) { dp[i] = findDp(i); dpRMQ[i] = min(dpRMQ[i - 1] , dp[i - 1] - a[i] * 2); } cout << dp[N - 1] + E; }
a.cc: In function 'll findDp(int)': a.cc:49:27: error: no matching function for call to 'min(ll&, int)' 49 | dp2 += min(dpRMQ[opt - 1] , 0); | ~~~^~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:49:27: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 49 | dp2 += min(dpRMQ[opt - 1] , 0); | ~~~^~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:49:27: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 49 | dp2 += min(dpRMQ[opt - 1] , 0); | ~~~^~~~~~~~~~~~~~~~~~~~
s791148456
p03940
C++
#include<iostream> #include<string> #include<ctime> #include<algorithm> #include<set> #include<vector> #include<queue> #include<cstdio> #include<map> #include<string.h> using namespace std; long long x[100008],dp[100008];long long t,e; void update(long long i,long long j) { dp[i]=min(dp[i],dp[j]+max(t,2*(x[i]-x[j+1]))); } int main() { long long n;cin>>n;cin>>e>>t; for(long long i=1;i<=n;i++) cin>>x[i];for(long long i=0;i<100005;i++) dp[i]=2e9;x[n+1]=2e9; dp[0]=0;long long j=0;long long mst=2e9,msi=0; for(long long i=1;i<=n;i++) { update(i,i-1); while((x[i]-x[j+1])*2>t and j<i-1) { j++;long long tt=dp[j]+2*(x[n+1]-x[j+1]); if(tt<mst) mst=tt,msi=j; } update(i,j);update(i,max(j-1,0));update(i,j+1); update(i,msi); } cout<<dp[n]+e; }
a.cc: In function 'int main()': a.cc:30:41: error: no matching function for call to 'max(long long int, int)' 30 | update(i,j);update(i,max(j-1,0));update(i,j+1); | ~~~^~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:30:41: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 30 | update(i,j);update(i,max(j-1,0));update(i,j+1); | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:4: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:30:41: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 30 | update(i,j);update(i,max(j-1,0));update(i,j+1); | ~~~^~~~~~~
s656330203
p03940
C++
#include <iostream> #include <cstring> #include <string> #include <algorithm> #include <cstdlib> #include <cstdio> #include <map> #include <set> #include <cmath> #include <vector> #include <ctime> #include <Queue> #include <sstream> #include <utility> #include <bitset> #include <stack> using namespace std; #define MP make_pair #define PB push_back #define INF (1000000007) #define eps 1e-8 #define MOD (1000003) #define IOS ios::sync_with_stdio(false) typedef pair<int,int> pii ; typedef pair<double,double> pdd ; typedef long long ll ; ll n,e,t; ll dp[100005],p[100005]; ll mx=1e18; multiset<ll>s; int main() { IOS; cin>>n>>e>>t; for(int i=1;i<=n;i++) cin>>p[i]; dp[0]=0; int pos=0; for(int i=1;i<=n;i++) { s.insert(dp[i-1]); while(pos<=i) { if((p[i]-p[pos])*2>t) { mx=min(dp[pos-1]-p[pos]*2,mx); s.erase(dp[pos-1]); pos++; } else break; } dp[i]=min(*s.begin()+t,mx+2*p[i]); } cout<<dp[n]+e; return 0; }
a.cc:12:10: fatal error: Queue: No such file or directory 12 | #include <Queue> | ^~~~~~~ compilation terminated.
s497002513
p03940
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, e, t; int x[100005]; ll f[100005]; ll tr[100005 << 2][2]; void Update(int L, int R, int p, int x, int l, int r, int rt) { if(L <= l && r <=R) { tr[rt] } } int main() { scanf("%d%d%d", &n, &e, &t); for(int i = 1; i <= n; i++) { scanf("%d", &x[i]); } memset(f, 0x3f, sizeof f); f[0] = 0; for(int i = 1; i <= n; i++) { for(int j = 0; j < i; j++) { f[i] = min(f[i], f[j] + max((x[i] - x[j + 1]) * 2, t) + (x[i] - x[j])); } } printf("%lld\n", f[n] + e - x[n]); return 0; }
a.cc: In function 'void Update(int, int, int, int, int, int, int)': a.cc:12:23: error: expected ';' before '}' token 12 | tr[rt] | ^ | ; 13 | } | ~
s729421791
p03940
C++
#include <bits/stdc++.h> #define maxn 100010 #define cmin(_a, _b) (_a > (_b) ? _a = (_b) : 0) int a[maxn], q[maxn]; long long f[maxn]; int main() { int n,m,T; scanf("%d%d%d",&n,&m,&T); for (int i=1;i<=n;++i)scanf("%d",&a[i]); int p = 1, h = 0, t = 0; long long fp = 1234567891234567ll; for (int i = 1; i <= n; ++i) { while ((a[i] - a[p]) * 2 > T) cmin(fp, f[p - 1] - 2 * a[p]), ++p; while (head < tail && (a[i] - a[q[head + 1]]) * 2 > T) ++head; f[i] = 1ll * i * T; cmin(f[i], fp + 2 * a[i]); head < tail ? cmin(f[i], f[q[head + 1] - 1] + T) : 0; cmin(f[i], f[i - 1] + T); while (head < tail && f[q[tail] - 1] > f[i]) --tail; q[++tail] = i; } printf("%lld\n", f[n] + m); return 0; }
a.cc: In function 'int main()': a.cc:17:24: error: 'head' was not declared in this scope; did you mean 'read'? 17 | while (head < tail && (a[i] - a[q[head + 1]]) * 2 > T) ++head; | ^~~~ | read a.cc:17:31: error: 'tail' was not declared in this scope; did you mean 'tanl'? 17 | while (head < tail && (a[i] - a[q[head + 1]]) * 2 > T) ++head; | ^~~~ | tanl a.cc:20:17: error: 'head' was not declared in this scope; did you mean 'read'? 20 | head < tail ? cmin(f[i], f[q[head + 1] - 1] + T) : 0; | ^~~~ | read a.cc:20:24: error: 'tail' was not declared in this scope; did you mean 'tanl'? 20 | head < tail ? cmin(f[i], f[q[head + 1] - 1] + T) : 0; | ^~~~ | tanl
s931043282
p03940
C++
#include <bits/stdc++.h> #define SZ(x) ((int) (x).size()) using namespace std; typedef long long i64; const int64_t LINF = 1LL << 62; int main() { #ifdef LOCAL_RUN freopen("task.in", "r", stdin); freopen("task.out", "w", stdout); //freopen("task.err", "w", stderr); #endif // ONLINE_JUDGE ios::sync_with_stdio(false); cin.tie(0); int n, E, T; cin >> n >> E >> T; vector<int> X(n + 1, 0); for (int i = 1; i <= n; ++i) { cin >> X[i]; } vector<int64_t> dp(n + 1, 0); deque<pair<int, int64_t>> d; for (int i = 1; i <= n; ++i) { dp[i] = LINF; int j = i - 1; int64_t time = -LINF; int64_t cval = dp[j] + X[j + 1] - X[j] + 3LL * (X[i] - X[j + 1]) + max((int64_t) 0, (int64_t) (T - 2LL * (X[i] - X[j + 1]))); int64_t currSteady = T + 2 * X[j + 1]; while (!d.empty()) { int p = d.back().first; int64_t pval = dp[p] + X[p + 1] - X[p] + 3LL * (X[i] - X[p + 1]) + max((int64_t) 0, (int64_t) (T - 2LL * (X[i] - X[p + 1]))); if (cval <= pval) { d.pop_back(); continue; } int64_t prevSteady = T + 2 * X[p + 1]; time = max(prevSteady, 2LL * X[i]) + cval - pval; if (time > currSteady) { time = LINF; } if (time <= d.back().second) { d.pop_back(); } else { break; } } if (d.empty()) { time = -LINF; } d.push_back(make_pair(j, time)); while (SZ(d) > 1 && 2 * X[i] >= d[1].second) { d.pop_front(); } d.front().second = -LINF; int p = d.front().first; int64_t pval = dp[p] + X[p + 1] - X[p] + 3LL * (X[i] - X[p + 1]) + max((int64_t) 0, (int64_t) (T - 2LL * (X[i] - X[p + 1]))); dp[i] = pval; } int64_t ans = dp[n] + E - X[n]; cout << ans << '\n'; }
a.cc: In function 'int main()': a.cc:46:23: error: no matching function for call to 'max(int64_t&, long long int)' 46 | time = max(prevSteady, 2LL * X[i]) + cval - pval; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:46:23: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int') 46 | time = max(prevSteady, 2LL * X[i]) + cval - pval; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:46:23: note: mismatched types 'std::initializer_list<_Tp>' and 'long int' 46 | time = max(prevSteady, 2LL * X[i]) + cval - pval; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~
s640467408
p03940
C++
#include <bits/stdc++.h> #define SZ(x) ((int) (x).size()) using namespace std; typedef long long i64; int main() { #ifdef LOCAL_RUN freopen("task.in", "r", stdin); freopen("task.out", "w", stdout); //freopen("task.err", "w", stderr); #endif // ONLINE_JUDGE ios::sync_with_stdio(false); cin.tie(0); int n, E, T; cin >> n >> E >> T; vector<int> X(n + 1, 0); for (int i = 1; i <= n; ++i) { cin >> X[i]; } vector<int64_t> dp(n + 1, 0); for (int i = 1; i <= n; ++i) { dp[i] = 1LL << 62; for (int j = i - 1; j >= 0; --j) { dp[i] = min((int64_t) dp[i], dp[j] + X[j + 1] - X[j] + 3LL * (X[i] - X[j + 1]) + max((int64_t) 0, (int64_t) (T - 2LL * (X[i] - X[j + 1])))); } } int64_t ans = dp[n] + E - X[n]; cout << ans << '\n'; }
a.cc: In function 'int main()': a.cc:28:24: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type, long long int)' 28 | dp[i] = min((int64_t) dp[i], dp[j] + X[j + 1] - X[j] + | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 29 | 3LL * (X[i] - X[j + 1]) + max((int64_t) 0, (int64_t) (T - 2LL * (X[i] - X[j + 1])))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:28:24: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int') 28 | dp[i] = min((int64_t) dp[i], dp[j] + X[j + 1] - X[j] + | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 29 | 3LL * (X[i] - X[j + 1]) + max((int64_t) 0, (int64_t) (T - 2LL * (X[i] - X[j + 1])))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:28:24: note: mismatched types 'std::initializer_list<_Tp>' and 'long int' 28 | dp[i] = min((int64_t) dp[i], dp[j] + X[j + 1] - X[j] + | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 29 | 3LL * (X[i] - X[j + 1]) + max((int64_t) 0, (int64_t) (T - 2LL * (X[i] - X[j + 1])))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s939732942
p03940
C++
#include <bits/stdc++.h> #define SZ(x) ((int) (x).size()) using namespace std; typedef long long i64; int main() { #ifdef LOCAL_RUN freopen("task.in", "r", stdin); freopen("task.out", "w", stdout); //freopen("task.err", "w", stderr); #endif // ONLINE_JUDGE ios::sync_with_stdio(false); cin.tie(0); int n, E, T; cin >> n >> E >> T; vector<int> X(n + 1, 0); for (int i = 1; i <= n; ++i) { cin >> X[i]; } vector<int64_t> dp(n + 1, 0); for (int i = 1; i <= n; ++i) { dp[i] = 1LL << 62; for (int j = i - 1; j >= 0; --j) { dp[i] = min(dp[i], dp[j] + X[j + 1] - X[j] + 3LL * (X[i] - X[j + 1]) + max((int64_t) 0, (int64_t) (T - 2LL * (X[i] - X[j + 1])))); } } int64_t ans = dp[n] + E - X[n]; cout << ans << '\n'; }
a.cc: In function 'int main()': a.cc:28:24: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type&, long long int)' 28 | dp[i] = min(dp[i], dp[j] + X[j + 1] - X[j] + | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 29 | 3LL * (X[i] - X[j + 1]) + max((int64_t) 0, (int64_t) (T - 2LL * (X[i] - X[j + 1])))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:28:24: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int') 28 | dp[i] = min(dp[i], dp[j] + X[j + 1] - X[j] + | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 29 | 3LL * (X[i] - X[j + 1]) + max((int64_t) 0, (int64_t) (T - 2LL * (X[i] - X[j + 1])))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:28:24: note: mismatched types 'std::initializer_list<_Tp>' and 'long int' 28 | dp[i] = min(dp[i], dp[j] + X[j + 1] - X[j] + | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 29 | 3LL * (X[i] - X[j + 1]) + max((int64_t) 0, (int64_t) (T - 2LL * (X[i] - X[j + 1])))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s865331820
p03940
C++
#include <bits/stdc++.h> #define SZ(x) ((int) (x).size()) using namespace std; typedef long long i64; int main() { #ifdef LOCAL_RUN freopen("task.in", "r", stdin); freopen("task.out", "w", stdout); //freopen("task.err", "w", stderr); #endif // ONLINE_JUDGE ios::sync_with_stdio(false); cin.tie(0); int n, E, T; cin >> n >> E >> T; vector<int> X(n + 1, 0); for (int i = 1; i <= n; ++i) { cin >> X[i]; } vector<int64_t> dp(n + 1, 0); for (int i = 1; i <= n; ++i) { dp[i] = 1LL << 62; for (int j = i - 1; j >= 0; --j) { dp[i] = min(dp[i], dp[j] + X[j + 1] - X[j] + 3LL * (X[i] - X[j + 1]) + max((int64_t) 0, (int64_t) T - 2LL * (X[i] - X[j + 1]))); } } int64_t ans = dp[n] + E - X[n]; cout << ans << '\n'; }
a.cc: In function 'int main()': a.cc:29:50: error: no matching function for call to 'max(int64_t, long long int)' 29 | 3LL * (X[i] - X[j + 1]) + max((int64_t) 0, (int64_t) T - 2LL * (X[i] - X[j + 1]))); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:29:50: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int') 29 | 3LL * (X[i] - X[j + 1]) + max((int64_t) 0, (int64_t) T - 2LL * (X[i] - X[j + 1]))); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:29:50: note: mismatched types 'std::initializer_list<_Tp>' and 'long int' 29 | 3LL * (X[i] - X[j + 1]) + max((int64_t) 0, (int64_t) T - 2LL * (X[i] - X[j + 1]))); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~