submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s935175456
p03723
Java
import java.util.Scanner; /** * Created by zzt on 17-5-6. */ public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int curA = scanner.nextInt(); int curB = scanner.nextInt(); int curC = scanner.nextInt(); int time = 0; if (curA == curB && curA == curC && curA % 2 == 0) { System.out.println(-1); return; } int tempA = 0, tempB = 0, tempC = 0; while (curA % 2 == 0 && curB % 2 == 0 % && curC % 2 == 0) { tempA = curB / 2 + curC / 2; tempB = curA / 2 + curC / 2; tempC = curA / 2 + curB / 2; curA = tempA; curB = tempB; curC = tempC; time++; } System.out.println(time); } }
Main.java:18: error: illegal start of expression while (curA % 2 == 0 && curB % 2 == 0 % && curC % 2 == 0) { ^ 1 error
s028049094
p03723
Java
/** * Created by zzt on 17-5-6. */ public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int curA = scanner.nextInt(); int curB = scanner.nextInt(); int curC = scanner.nextInt(); int time = 0; if (curA == curB && curA == curC && curA % 2 == 0) { System.out.println(-1); return; } int tempA = 0, tempB = 0, tempC = 0; while (curA % 2 == 0 && curB % 2 == 0 % && curC % 2 == 0) { tempA = curB / 2 + curC / 2; tempB = curA / 2 + curC / 2; tempC = curA / 2 + curB / 2; curA = tempA; curB = tempB; curC = tempC; time++; } System.out.println(time); } }
Main.java:17: error: illegal start of expression while (curA % 2 == 0 && curB % 2 == 0 % && curC % 2 == 0) { ^ 1 error
s903819455
p03723
C++
#include <bits/stdc++.h> #define MAX 1000005 #define ll long long #define upperlimit 1000100 #define INF 1e18 #define eps 1e-8 #define endl '\n' #define pcc pair<char,char> #define pii pair<int,int> #define pll pair<ll,ll> #define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++) #define MOD 1000000007 #define slld(t) scanf("%lld",&t) #define sd(t) scanf("%d",&t) #define pd(t) printf("%d\n",t) #define plld(t) printf("%lld\n",t) #define mp(a,b) make_pair(a,b) #define FF first #define SS second #define pb(x) push_back(x) #define vi vector<int> #define clr(a) memset(a,0,sizeof(a)) #define debug(a) printf("check%d\n",a) #define csl ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; int main() { int a,b,c; cin>>a>>b>>c; if(a==b&&a==c) { cout<<"-1"<<endl; return 0; } while(a%2==0||b%2==0||c%2==0) { int p=b/2+c/2; int d=a/2+c/2; int l=a/2+b/2; a=p;b=d;c=l; ans++; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:43:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 43 | ans++; | ^~~ | abs a.cc:45:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 45 | cout<<ans<<endl; | ^~~ | abs
s097940795
p03723
C++
#include <cstdio> using namespace std; int main() { // freopen("testcase", "r", stdin); int a, b, c; scanf("%d%d%d", &a, &b, &c); int cnt = 0; while (true) { if (a == b && b == c) { printf("-1\n"); return 0; } if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) { printf("%d\n", cnt); return 0; } int ta = (b + c) / 2; int tb = (a + c) / 2; int tc = (a + b) / 2; cnt++; a = ta; b = tb; c = tc; } return 0; }%
a.cc:31:2: error: expected unqualified-id before '%' token 31 | }% | ^
s198243712
p03723
Java
import java.awt.*; import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.List; import static java.lang.Math.PI; import static java.lang.Math.max; import static java.lang.Math.min; public class A implements Runnable{ // SOLUTION!!! // HACK ME PLEASE IF YOU CAN!!! // PLEASE!!! // PLEASE!!! // PLEASE!!! private final static Random rnd = new Random(); private final static String fileName = ""; static class Triple { int a, b, c; public Triple(int a, int b, int c) { this.a = a; this.b = b; this.c = c; } @Override public int hashCode() { int hash = 1; hash += a * 15871931; hash += b * 129831741; hash += c * 29471081; return hash; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return this == null; Triple other = (Triple) obj; if (a != other.a) return false; if (b != other.b) return false; if (c != other.c) return false; return true; } Triple next() { if (a % 2 == 1) return null; if (b % 2 == 1) return null; if (c % 2 == 1) return null; int nextA = b / 2 + c / 2; int nextB = a / 2 + c / 2; int nextC = a / 2 + b / 2; return new Triple(nextA, nextB, nextC); } } private void solve() { int a = readInt(); int b = readInt(); int c = readInt(); Set<Triple> used = new HashSet<>(); for (Triple cur = new Triple(a, b, c); ; cur = cur.next()) { if (cur == null) { out.println(used.size() - 1); return; } if (used.contains(cur)) { out.println(-1); return; } used.add(cur); } } ///////////////////////////////////////////////////////////////////// private final static boolean FIRST_INPUT_STRING = false; private final static boolean MULTIPLE_TESTS = true; private final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; private final static int MAX_STACK_SIZE = 128; private final static boolean OPTIMIZE_READ_NUMBERS = false; ///////////////////////////////////////////////////////////////////// public void run(){ try{ timeInit(); Locale.setDefault(Locale.US); init(); if (ONLINE_JUDGE) { solve(); } else { do { try { timeInit(); solve(); time(); out.println(); } catch (NumberFormatException e) { break; } catch (NullPointerException e) { if (FIRST_INPUT_STRING) break; else throw e; } } while (MULTIPLE_TESTS); } out.close(); time(); }catch (Exception e){ e.printStackTrace(System.err); System.exit(-1); } } ///////////////////////////////////////////////////////////////////// private BufferedReader in; private OutputWriter out; private StringTokenizer tok = new StringTokenizer(""); public static void main(String[] args){ new Thread(null, new A(), "", MAX_STACK_SIZE * (1L << 20)).start(); } ///////////////////////////////////////////////////////////////////// private void init() throws FileNotFoundException{ Locale.setDefault(Locale.US); if (ONLINE_JUDGE){ if (fileName.isEmpty()) { in = new BufferedReader(new InputStreamReader(System.in)); out = new OutputWriter(System.out); } else { in = new BufferedReader(new FileReader(fileName + ".in")); out = new OutputWriter(fileName + ".out"); } }else{ in = new BufferedReader(new FileReader("input.txt")); out = new OutputWriter("output.txt"); } } //////////////////////////////////////////////////////////////// private long timeBegin; private void timeInit() { this.timeBegin = System.currentTimeMillis(); } private void time(){ long timeEnd = System.currentTimeMillis(); System.err.println("Time = " + (timeEnd - timeBegin)); } private void debug(Object... objects){ if (ONLINE_JUDGE){ for (Object o: objects){ System.err.println(o.toString()); } } } ///////////////////////////////////////////////////////////////////// private String delim = " "; private String readLine() { try { return in.readLine(); } catch (IOException e) { throw new RuntimeIOException(e); } } private String readString() { try { while(!tok.hasMoreTokens()){ tok = new StringTokenizer(readLine()); } return tok.nextToken(delim); } catch (NullPointerException e) { return null; } } ///////////////////////////////////////////////////////////////// private final char NOT_A_SYMBOL = '\0'; private char readChar() { try { int intValue = in.read(); if (intValue == -1){ return NOT_A_SYMBOL; } return (char) intValue; } catch (IOException e) { throw new RuntimeIOException(e); } } private char[] readCharArray() { return readLine().toCharArray(); } private char[][] readCharField(int rowsCount) { char[][] field = new char[rowsCount][]; for (int row = 0; row < rowsCount; ++row) { field[row] = readCharArray(); } return field; } ///////////////////////////////////////////////////////////////// private long optimizedReadLong() { int sign = 1; long result = 0; boolean started = false; while (true) { try { int j = in.read(); if (-1 == j) { if (started) return sign * result; throw new NumberFormatException(); } if (j == '-') { if (started) throw new NumberFormatException(); sign = -sign; } if ('0' <= j && j <= '9') { result = result * 10 + j - '0'; started = true; } else if (started) { return sign * result; } } catch (IOException e) { throw new RuntimeIOException(e); } } } private int readInt() { if (!OPTIMIZE_READ_NUMBERS) { return Integer.parseInt(readString()); } else { return (int) optimizedReadLong(); } } private int[] readIntArray(int size) { int[] array = new int[size]; for (int index = 0; index < size; ++index){ array[index] = readInt(); } return array; } private int[] readSortedIntArray(int size) { Integer[] array = new Integer[size]; for (int index = 0; index < size; ++index) { array[index] = readInt(); } Arrays.sort(array); int[] sortedArray = new int[size]; for (int index = 0; index < size; ++index) { sortedArray[index] = array[index]; } return sortedArray; } private int[] readIntArrayWithDecrease(int size) { int[] array = readIntArray(size); for (int i = 0; i < size; ++i) { array[i]--; } return array; } /////////////////////////////////////////////////////////////////// private int[][] readIntMatrix(int rowsCount, int columnsCount) { int[][] matrix = new int[rowsCount][]; for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) { matrix[rowIndex] = readIntArray(columnsCount); } return matrix; } private int[][] readIntMatrixWithDecrease(int rowsCount, int columnsCount) { int[][] matrix = new int[rowsCount][]; for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) { matrix[rowIndex] = readIntArrayWithDecrease(columnsCount); } return matrix; } /////////////////////////////////////////////////////////////////// private long readLong() { if (!OPTIMIZE_READ_NUMBERS) { return Long.parseLong(readString()); } else { return optimizedReadLong(); } } private long[] readLongArray(int size) { long[] array = new long[size]; for (int index = 0; index < size; ++index){ array[index] = readLong(); } return array; } //////////////////////////////////////////////////////////////////// private double readDouble() { return Double.parseDouble(readString()); } private double[] readDoubleArray(int size) { double[] array = new double[size]; for (int index = 0; index < size; ++index){ array[index] = readDouble(); } return array; } //////////////////////////////////////////////////////////////////// private BigInteger readBigInteger() { return new BigInteger(readString()); } private BigDecimal readBigDecimal() { return new BigDecimal(readString()); } ///////////////////////////////////////////////////////////////////// private Point readPoint() { int x = readInt(); int y = readInt(); return new Point(x, y); } private Point[] readPointArray(int size) { Point[] array = new Point[size]; for (int index = 0; index < size; ++index){ array[index] = readPoint(); } return array; } ///////////////////////////////////////////////////////////////////// @Deprecated private List<Integer>[] readGraph(int vertexNumber, int edgeNumber) { @SuppressWarnings("unchecked") List<Integer>[] graph = new List[vertexNumber]; for (int index = 0; index < vertexNumber; ++index){ graph[index] = new ArrayList<>(); } while (edgeNumber-- > 0){ int from = readInt() - 1; int to = readInt() - 1; graph[from].add(to); graph[to].add(from); } return graph; } private static class GraphBuilder { final int size; final List<Integer>[] edges; static GraphBuilder createInstance(int size) { List<Integer>[] edges = new List[size]; for (int v = 0; v < size; ++v) { edges[v] = new ArrayList<>(); } return new GraphBuilder(edges); } private GraphBuilder(List<Integer>[] edges) { this.size = edges.length; this.edges = edges; } public void addEdge(int from, int to) { addDirectedEdge(from, to); addDirectedEdge(to, from); } public void addDirectedEdge(int from, int to) { edges[from].add(to); } public int[][] build() { int[][] graph = new int[size][]; for (int v = 0; v < size; ++v) { List<Integer> vEdges = edges[v]; graph[v] = castInt(vEdges); } return graph; } } ///////////////////////////////////////////////////////////////////// private static class IntIndexPair { static Comparator<IntIndexPair> increaseComparator = new Comparator<A.IntIndexPair>() { @Override public int compare(A.IntIndexPair indexPair1, A.IntIndexPair indexPair2) { int value1 = indexPair1.value; int value2 = indexPair2.value; if (value1 != value2) return value1 - value2; int index1 = indexPair1.index; int index2 = indexPair2.index; return index1 - index2; } }; static Comparator<IntIndexPair> decreaseComparator = new Comparator<A.IntIndexPair>() { @Override public int compare(A.IntIndexPair indexPair1, A.IntIndexPair indexPair2) { int value1 = indexPair1.value; int value2 = indexPair2.value; if (value1 != value2) return -(value1 - value2); int index1 = indexPair1.index; int index2 = indexPair2.index; return index1 - index2; } }; static IntIndexPair[] from(int[] array) { IntIndexPair[] iip = new IntIndexPair[array.length]; for (int i = 0; i < array.length; ++i) { iip[i] = new IntIndexPair(array[i], i); } return iip; } int value, index; IntIndexPair(int value, int index) { super(); this.value = value; this.index = index; } int getRealIndex() { return index + 1; } } private IntIndexPair[] readIntIndexArray(int size) { IntIndexPair[] array = new IntIndexPair[size]; for (int index = 0; index < size; ++index) { array[index] = new IntIndexPair(readInt(), index); } return array; } ///////////////////////////////////////////////////////////////////// private static class OutputWriter extends PrintWriter { final int DEFAULT_PRECISION = 12; private int precision; private String format, formatWithSpace; { precision = DEFAULT_PRECISION; format = createFormat(precision); formatWithSpace = format + " "; } OutputWriter(OutputStream out) { super(out); } OutputWriter(String fileName) throws FileNotFoundException { super(fileName); } int getPrecision() { return precision; } void setPrecision(int precision) { precision = max(0, precision); this.precision = precision; format = createFormat(precision); formatWithSpace = format + " "; } String createFormat(int precision){ return "%." + precision + "f"; } @Override public void print(double d){ printf(format, d); } void printWithSpace(double d){ printf(formatWithSpace, d); } void printAll(double...d){ for (int i = 0; i < d.length - 1; ++i){ printWithSpace(d[i]); } print(d[d.length - 1]); } @Override public void println(double d){ printlnAll(d); } void printlnAll(double... d){ printAll(d); println(); } } ///////////////////////////////////////////////////////////////////// private static class RuntimeIOException extends RuntimeException { /** * */ private static final long serialVersionUID = -6463830523020118289L; RuntimeIOException(Throwable cause) { super(cause); } } ///////////////////////////////////////////////////////////////////// //////////////// Some useful constants and functions //////////////// ///////////////////////////////////////////////////////////////////// private static final int[][] steps = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; private static final int[][] steps8 = { {-1, 0}, {1, 0}, {0, -1}, {0, 1}, {-1, -1}, {1, 1}, {1, -1}, {-1, 1} }; private static boolean checkCell(int row, int rowsCount, int column, int columnsCount) { return checkIndex(row, rowsCount) && checkIndex(column, columnsCount); } private static boolean checkIndex(int index, int lim){ return (0 <= index && index < lim); } ///////////////////////////////////////////////////////////////////// private static boolean checkBit(int mask, int bit){ return (mask & (1 << bit)) != 0; } private static boolean checkBit(long mask, int bit){ return (mask & (1L << bit)) != 0; } ///////////////////////////////////////////////////////////////////// private static long getSum(int[] array) { long sum = 0; for (int value: array) { sum += value; } return sum; } private static Point getMinMax(int[] array) { int min = array[0]; int max = array[0]; for (int index = 0, size = array.length; index < size; ++index, ++index) { int value = array[index]; if (index == size - 1) { min = min(min, value); max = max(max, value); } else { int otherValue = array[index + 1]; if (value <= otherValue) { min = min(min, value); max = max(max, otherValue); } else { min = min(min, otherValue); max = max(max, value); } } } return new Point(min, max); } ///////////////////////////////////////////////////////////////////// private static int[] getPrimes(int n) { boolean[] used = new boolean[n]; used[0] = used[1] = true; int size = 0; for (int i = 2; i < n; ++i) { if (!used[i]) { ++size; for (int j = 2 * i; j < n; j += i) { used[j] = true; } } } int[] primes = new int[size]; for (int i = 0, cur = 0; i < n; ++i) { if (!used[i]) { primes[cur++] = i; } } return primes; } ///////////////////////////////////////////////////////////////////// private static long lcm(long a, long b) { return a / gcd(a, b) * b; } private static long gcd(long a, long b) { return (a == 0 ? b : gcd(b % a, a)); } ///////////////////////////////////////////////////////////////////// private static class MultiSet<ValueType> { public static <ValueType> MultiSet<ValueType> createMultiSet() { Map<ValueType, Integer> multiset = new HashMap<>(); return new MultiSet<>(multiset); } private final Map<ValueType, Integer> multiset; private int size; public MultiSet(Map<ValueType, Integer> multiset) { this.multiset = multiset; this.size = 0; } public int size() { return size; } public void inc(ValueType value) { int count = get(value); multiset.put(value, count + 1); ++size; } public void dec(ValueType value) { int count = get(value); if (count == 0) return; if (count == 1) multiset.remove(value); else multiset.put(value, count - 1); --size; } public int get(ValueType value) { Integer count = multiset.get(value); return (count == null ? 0 : count); } } ///////////////////////////////////////////////////////////////////// private static class IdMap<KeyType> extends HashMap<KeyType, Integer> { /** * */ private static final long serialVersionUID = -3793737771950984481L; public IdMap() { super(); } int getId(KeyType key) { Integer id = super.get(key); if (id == null) { super.put(key, id = size()); } return id; } } ///////////////////////////////////////////////////////////////////// private static int[] castInt(List<Integer> list) { int[] array = new int[list.size()]; for (int i = 0; i < array.length; ++i) { array[i] = list.get(i); } return array; } private static long[] castLong(List<Long> list) { long[] array = new long[list.size()]; for (int i = 0; i < array.length; ++i) { array[i] = list.get(i); } return array; } ///////////////////////////////////////////////////////////////////// /** * Generates list with values 0..<n * @param n - exclusive limit of sequence */ private static List<Integer> order(int n) { List<Integer> sequence = new ArrayList<>(); for (int i = 0; i < n; ++i) { sequence.add(i); } return sequence; } }
Main.java:13: error: class A is public, should be declared in a file named A.java public class A implements Runnable{ ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
s180278564
p03723
C++
#include<bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; using namespace std; #define pb push_back int dy[]={0, 0, 1, -1, 0}; int dx[]={1, -1, 0, 0, 0}; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) int main(void){ ll a,b,c,d,e,f; scanf("%lld%lld%lld",&a,&b,&c); ll count = 0; while(count < 100000000){ if(a % 2 || b % 2 || c % 2){ printf("%lld\n",count);#include<bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; using namespace std; #define pb push_back int dy[]={0, 0, 1, -1, 0}; int dx[]={1, -1, 0, 0, 0}; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) int main(void){ ll a,b,c,d,e,f; scanf("%lld%lld%lld",&a,&b,&c); ll count = 0; while(count < 100000000){ if(a % 2 || b % 2 || c % 2){ printf("%lld\n",count); return 0; } count++; d = a / 2;e = b / 2;f = c / 2; a = e + f;b = f + d;c = d + e; } printf("-1\n"); return 0; } #include<bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; using namespace std; #define pb push_back int dy[]={0, 0, 1, -1, 0}; int dx[]={1, -1, 0, 0, 0}; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) int main(void){ ll a,b,c,d,e,f; scanf("%lld%lld%lld",&a,&b,&c); ll count = 0; while(count < 100000000){ if(a % 2 || b % 2 || c % 2){ printf("%lld\n",count); return 0; } count++; d = a / 2;e = b / 2;f = c / 2; a = e + f;b = f + d;c = d + e; } printf("-1\n"); return 0; } return 0;#include<bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; using namespace std; #define pb push_back int dy[]={0, 0, 1, -1, 0}; int dx[]={1, -1, 0, 0, 0}; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) int main(void){ ll a,b,c,d,e,f; scanf("%lld%lld%lld",&a,&b,&c); ll count = 0; while(count < 100000000){ if(a % 2 || b % 2 || c % 2){ printf("%lld\n",count); return 0; } count++; #include<bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; using namespace std; #define pb push_back int dy[]={0, 0, 1, -1, 0}; int dx[]={1, -1, 0, 0, 0}; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) int main(void){ ll a,b,c,d,e,f; scanf("%lld%lld%lld",&a,&b,&c); ll count = 0; while(count < 500000000){ if(a % 2 || b % 2 || c % 2){ printf("%lld\n",count); return 0; } count++; d = a / 2;e = b / 2;f = c / 2; a = e + f;b = f + d;c = d + e; } printf("-1\n"); return 0; } d = a / 2;e = b / 2;f = c / 2; a = e + f;b = f + d;c = d + e; } printf("-1\n"); return 0; } } count++; d = a / 2;e = b / 2;f = c / 2; a = e + f;b = f + d;c = d + e; } printf("-1\n"); return 0; }
a.cc:22:36: error: stray '#' in program 22 | printf("%lld\n",count);#include<bits/stdc++.h> | ^ a.cc:87:22: error: stray '#' in program 87 | return 0;#include<bits/stdc++.h> | ^ a.cc: In function 'int main()': a.cc:22:37: error: 'include' was not declared in this scope 22 | printf("%lld\n",count);#include<bits/stdc++.h> | ^~~~~~~ a.cc:22:45: error: 'bits' was not declared in this scope 22 | printf("%lld\n",count);#include<bits/stdc++.h> | ^~~~ a.cc:22:50: error: 'stdc' was not declared in this scope; did you mean 'std'? 22 | printf("%lld\n",count);#include<bits/stdc++.h> | ^~~~ | std a.cc:23:1: error: expected primary-expression before 'typedef' 23 | typedef long long ll; | ^~~~~~~ a.cc:35:15: error: a function-definition is not allowed here before '{' token 35 | int main(void){ | ^ a.cc:59:5: error: redeclaration of 'int dy []' 59 | int dy[]={0, 0, 1, -1, 0}; | ^~ a.cc:27:5: note: 'int dy [5]' previously declared here 27 | int dy[]={0, 0, 1, -1, 0}; | ^~ a.cc:60:5: error: redeclaration of 'int dx []' 60 | int dx[]={1, -1, 0, 0, 0}; | ^~ a.cc:28:5: note: 'int dx [5]' previously declared here 28 | int dx[]={1, -1, 0, 0, 0}; | ^~ a.cc:67:15: error: a function-definition is not allowed here before '{' token 67 | int main(void){ | ^ a.cc:88:1: error: expected primary-expression before 'typedef' 88 | typedef long long ll; | ^~~~~~~ a.cc:92:5: error: redeclaration of 'int dy []' 92 | int dy[]={0, 0, 1, -1, 0}; | ^~ a.cc:27:5: note: 'int dy [5]' previously declared here 27 | int dy[]={0, 0, 1, -1, 0}; | ^~ a.cc:93:5: error: redeclaration of 'int dx []' 93 | int dx[]={1, -1, 0, 0, 0}; | ^~ a.cc:28:5: note: 'int dx [5]' previously declared here 28 | int dx[]={1, -1, 0, 0, 0}; | ^~ a.cc:100:15: error: a function-definition is not allowed here before '{' token 100 | int main(void){ | ^
s694286809
p03723
C++
#include <stdio.h> void main() { int a, b, c; int count; scanf("%d %d %d", &a, &b, &c); while((a % 2 == 0) && (b % 2 == 0) && (c % 2 == 0)) { int tmpa = a, tmpb = b, tmpc = c; a += tmpb/2 + tmpc/2; b += tmpc/2 + tmpa/2; c += tmpa/2 + tmpb/2; count++; } printf("%d", count); }
a.cc:3:1: error: '::main' must return 'int' 3 | void main() | ^~~~
s423050065
p03723
C++
a, b, c = map(int, raw_input().split()) def hoge(a, b, c): a, b, c = (b + c) / 2, (a + c) / 2, (a + b) / 2 return a, b, c for i in xrange(108000): if a % 2 == 1 or b % 2 == 1 or c % 2 == 1: print i exit() a, b, c = hoge(a, b, c) print -1
a.cc:1:1: error: 'a' does not name a type 1 | a, b, c = map(int, raw_input().split()) | ^
s832859074
p03724
C++
//考察系
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s507857451
p03724
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; } int nnn void dfs(string s, char m){ if((int)s.size()==nnn){ cout << s << endl;} else{ for(char c='a';c<=m; c++){ dfs(s+c,((c==m)?char(m+1):m)); } } } int main() { ll n,m; cin>>n>>m; ll a[n]={}; rep(i,m){ ll b,c; cin>>b>>c; a[b-1]++; a[c-1]++;} ll f=0; rep(i,n){ if(a[i]%2!=0) { f++; break;}} if(f==1) cout << "NO" << endl; else cout << "YES" << endl;}
a.cc:109:1: error: expected initializer before 'void' 109 | void dfs(string s, char m){ | ^~~~
s051547792
p03724
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; } void dfs(string s, char m){ if((int)s.size()==n){ cout << s << endl;} else{ for(char c='a';c<=m; c++){ dfs(s+c,((c==m)?char(m+1):m)); } } } int main() { ll n,m; cin>>n>>m; ll a[n]={}; rep(i,m){ ll b,c; cin>>b>>c; a[b-1]++; a[c-1]++;} ll f=0; rep(i,n){ if(a[i]%2!=0) { f++; break;}} if(f==1) cout << "NO" << endl; else cout << "YES" << endl;}
a.cc: In function 'void dfs(std::string, char)': a.cc:109:21: error: 'n' was not declared in this scope 109 | if((int)s.size()==n){ | ^
s591593639
p03724
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; int n, m; int main() { cin.sync_with_stdio(0); cin.tie(0); cin >> n >> m; int tot = 0; for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; tot += b - a; } if (tot % 2 || tot % (n - 1)) cout << "NO"; else cout << "YES"; } }
a.cc:19:1: error: expected declaration before '}' token 19 | } | ^
s599777487
p03724
C++
n
a.cc:1:1: error: 'n' does not name a type 1 | n | ^
s409004361
p03724
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N,m; cin>>N>>m; map<int,int>M; for(int i=0;i<2*m;i++){ int a; cin>>a; if(M.count(a)); M.at(a)++; else M[a]=1; }bool ans=true; for(auto p:M){ auto k=p.first; auto v=p.second; if(v%2==1){ ans=false; break; } }if(ans) cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:5: error: 'else' without a previous 'if' 11 | else | ^~~~
s253694023
p03724
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N,M; cin>>N>>M; map<int,int>M; for(int i=0;i<2*M;i++){ int a; cin>>a; if(M.count(a)); M.at(a)++; else M[a]=1; }bool ans=true; for(auto p:M){ auto k=p.first; auto v=p.second; if(v%2==1){ ans=false; break; } }if(ans) cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:15: error: conflicting declaration 'std::map<int, int> M' 6 | map<int,int>M; | ^ a.cc:4:7: note: previous declaration as 'int M' 4 | int N,M; | ^ a.cc:9:10: error: request for member 'count' in 'M', which is of non-class type 'int' 9 | if(M.count(a)); | ^~~~~ a.cc:10:7: error: request for member 'at' in 'M', which is of non-class type 'int' 10 | M.at(a)++; | ^~ a.cc:11:5: error: 'else' without a previous 'if' 11 | else | ^~~~ a.cc:12:8: error: invalid types 'int[int]' for array subscript 12 | M[a]=1; | ^ a.cc:14:14: error: 'begin' was not declared in this scope 14 | for(auto p:M){ | ^ a.cc:14:14: note: suggested alternatives: 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:1238:5: note: 'std::begin' 1238 | begin(const valarray<_Tp>& __va) noexcept | ^~~~~ In file included from /usr/include/c++/14/filesystem:53, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200: /usr/include/c++/14/bits/fs_dir.h:608:3: note: 'std::filesystem::__cxx11::begin' 608 | begin(recursive_directory_iterator __iter) noexcept | ^~~~~ a.cc:14:14: error: 'end' was not declared in this scope 14 | for(auto p:M){ | ^ a.cc:14:14: note: suggested alternatives: /usr/include/c++/14/valarray:1265:5: note: 'std::end' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/bits/fs_dir.h:613:3: note: 'std::filesystem::__cxx11::end' 613 | end(recursive_directory_iterator) noexcept | ^~~
s050553107
p03724
C++
#include "template.cpp" int main() { int n = IN, m = IN; Graph graph(n); rep(m) { int u = IN1, v = IN1; graph[u].emplace_back(v); graph[v].emplace_back(u); } rep(v, n) if (graph[v].size() % 2) EXIT("NO"); OUT("YES"); }
a.cc:1:10: fatal error: template.cpp: No such file or directory 1 | #include "template.cpp" | ^~~~~~~~~~~~~~ compilation terminated.
s859951837
p03724
C++
#pragma GCC optimize("O3") #include <bits/stdc++.h> #define ll long long #define rep(i,n) for(ll i=0;i<(n);i++) #define pll pair<ll,ll> #define pq priority_queue #define pb push_back #define eb emplace_back #define fi first #define se second #define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define lb(c,x) distance(c.begin(),lower_bound(all(c),x)) #define ub(c,x) distance(c.begin(),upper_bound(all(c),x)) using namespace std; template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;} template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} const ll mod=1234567; int main(){ ll n,m; cin >> n >> m; vector<ll> c(n); rep(i,m){ ll a,b; cin >> a >> b; a--; b--; c[a]++; c[b]++; } bool ok=true; rep(i,n){ i(c[i]%2==1){ ok=false; } } if(ok) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
a.cc: In function 'int main()': a.cc:35:10: error: 'i' cannot be used as a function 35 | i(c[i]%2==1){ | ~^~~~~~~~~~~
s684881014
p03724
C++
#include <bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(false); cin.tie(0); #define FOR(i,s,n) for(int i = (s); i < (n); i++) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) for(int i = (n); i >= 0; i--) #define ALL(n) (n).begin(), (n).end() #define RALL(n) (n).rbegin(), (n).rend() #define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n'; #define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n'; #define OUT(n) cout << (n) << '\n'; using ll = long long; using ull = unsigned long long; using pii = pair<int,int>; using pll = pair<ll,ll>; int main(void) { IOS int N, M; cin >> N >> M; vector<int> v(N); REP(i,M) { int a, b; cin >> a >> b; a--; b--; v[a]++; v[b]--; } bool ans = true; REP(i,N) if (v[a] % 2 != 0) { ans = false; break; } CFYN(ans) return 0; }
a.cc: In function 'int main()': a.cc:32:20: error: 'a' was not declared in this scope 32 | REP(i,N) if (v[a] % 2 != 0) { | ^
s368058542
p03724
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) #define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++) #define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--) #define INF (1ll<<60) #define all(x) (x).begin(),(x).end() typedef long long lint; const lint MOD =1000000007; const lint MAX = 1000000; using Graph =vector<vector<lint>>; typedef pair<lint,lint> P; lint fac[MAX], finv[MAX], inv[MAX]; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (lint i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } long long COM(lint n, lint k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } lint primary(lint num) { if (num < 2) return 0; else if (num == 2) return 1; else if (num % 2 == 0) return 0; double sqrtNum = sqrt(num); for (int i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) { return 0; } } return 1; } long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } lint lcm(lint a,lint b){ return a/__gcd(a,b)*b; } lint gcd(lint a,lint b){ return __gcd(a,b); } //解説AC int main(){ lint n,m; cin>>n>>m; map<lint,lint>mp; rep(i,m){ lint a,b; cin>>a>>b; mp[a]++; mp[b]++; } for(auto x:mp){ if(x.second%2==1){ cout<<"NO" } } cout<<"YES"; }
a.cc: In function 'int main()': a.cc:84:27: error: expected ';' before '}' token 84 | cout<<"NO" | ^ | ; 85 | } | ~
s574640422
p03724
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) #define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++) #define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--) #define INF (1ll<<60) #define all(x) (x).begin(),(x).end() typedef long long lint; const lint MOD =1000000007; const lint MAX = 1000000; using Graph =vector<vector<lint>>; typedef pair<lint,lint> P; lint fac[MAX], finv[MAX], inv[MAX]; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (lint i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } long long COM(lint n, lint k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } lint primary(lint num) { if (num < 2) return 0; else if (num == 2) return 1; else if (num % 2 == 0) return 0; double sqrtNum = sqrt(num); for (int i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) { return 0; } } return 1; } long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } lint lcm(lint a,lint b){ return a/__gcd(a,b)*b; } lint gcd(lint a,lint b){ return __gcd(a,b); } //解説AC int main(){ lint n,m; cin>>n>>m; map<lint,lint>mp; rep(i,m){ lint a,b; cin>>a>>b; mp[a]++; mp[b]++; } for(auto x:mp){ if(mp.second%2==1){ cout<<"NO" } } cout<<"YES"; }
a.cc: In function 'int main()': a.cc:83:19: error: 'class std::map<long long int, long long int>' has no member named 'second' 83 | if(mp.second%2==1){ | ^~~~~~ a.cc:84:27: error: expected ';' before '}' token 84 | cout<<"NO" | ^ | ; 85 | } | ~
s599444425
p03724
C++
///////////// UnionFind // バラバラの要素を結合してグループにまとめる際に使える構造。 // グループ番号、要素数の取得が可能だが、グループに属する要素の列挙はO(N)かかる。 class UnionFindClass { public: UnionFindClass() { N = 0; parent = NULL; size = NULL; } ~UnionFindClass() { if (parent != NULL) { delete[] parent; } if (size != NULL) { delete[] size; } } void activate(int n) {// 要素の数N N = n; parent = new int[N]; size = new int[N]; for (int i = 0; i < N; i++) { parent[i] = -1; size[i] = 1; } } inline int getParent(int x) {// グループの親の番号を得る if (parent[x] == -1) { return x; } else { int y = getParent(parent[x]); parent[x] = y; return y; } } inline int getSize(int x) {// 自分が属するグループのサイズを得る x = getParent(x); return size[x]; } inline bool connect(int x, int y) {// 二つの要素を結ぶ。2グループ間を繋いだ場合trueを返す x = getParent(x); y = getParent(y); if (x == y) { return false; } int xsize = getSize(x), ysize = getSize(y); if (xsize < ysize) { parent[x] = y; size[y] += size[x]; size[x] = 0; } else { parent[y] = x; size[x] += size[y]; size[y] = 0; } return true; } //データ int N;// 個数 int* parent;// 親の番号。自分自身が親なら-1。 int* size;// 親のみ有効。自分のグループのサイズ。 }; ///////////// グラフを扱うクラス class GraphClass {// グラフ入力を受け取る public: GraphClass() { N = 0; M = 0; next = NULL; weight = NULL; directedFlag = false; } void activate(int n, bool directed = false) {// 頂点数nのグラフを初期化する。 directedFlag = directed; N = n; M = 0; edge.clear(); edgeActiveFlag.clear(); if (next != NULL) { delete[] next; } if (weight != NULL) { delete[] weight; } next = new unordered_map<int, int>[N]; weight = new ll[N]; for (int i = 0; i < N; i++) { weight[i] = 1; } } inline void setNodeWeight(int n, ll weight) {// n番のノードの重みをweightに設定 this->weight[n] = weight; } inline int getEdgeIndex(int x, int y) {// 辺の組からエッジの番号を得る if (next[x].find(y) != next[x].end()) { return next[x][y]; } return -1; } inline void addEdge(int x, int y, ll weight = 1) {// エッジ追加 int n = (int)edge.size(); edge.push_back({ {x,y}, weight }); edgeActiveFlag.push_back(true); next[x].insert({ y, n }); if (directedFlag == false) { next[y].insert({ x, n }); } M++; } inline void removeEdge(int x, int y) {// エッジ除去 int k = getEdgeIndex(x, y); if (k == -1) { return; } x = edge[k].first.first; y = edge[k].first.second; M--; edgeActiveFlag[k] = false; next[x].erase(next[x].find(y)); if (directedFlag == false) { next[y].erase(next[y].find(x)); } } bool isTree() {// 木になっているかどうか幅優先探索で調べる if (N <= 0 || M != N - 1) { return false; } bool* visited = new bool[N]; for (int i = 0; i < N; i++) { visited[i] = (i == 0); } queue<int> q; q.push(0); while (q.size() > 0) { int n = q.front(); q.pop(); visited[n] = true; for (auto itr = next[n].begin(); itr != next[n].end(); itr++) { if (visited[itr->first] == false) { q.push(itr->first); } } } for (int i = 0; i < N; i++) { if (visited[i] == false) { delete[] visited; return false; } } delete[] visited; return true; } GraphClass* kruskal() {// クラスカル法によって最小全域木を構成する GraphClass* G = new GraphClass(); G->activate(N, directedFlag); UnionFindClass uf; uf.activate(N); vector<pair<ll, pair<int, int>>> E; { int i = 0; for (auto itr = edge.begin(); itr != edge.end(); itr++, i++) { if (edgeActiveFlag[i] == false) { continue; } E.push_back({ itr->second, {itr->first.first, itr->first.second} }); } } sort(E.begin(), E.end()); for (auto itr = E.begin(); itr != E.end(); itr++) { int x = itr->second.first, y = itr->second.second; ll w = itr->first; if (uf.getParent(x) != uf.getParent(y)) { G->addEdge(x, y, w); uf.connect(x, y); } } return G; } ll* dijkstra(int n) {// ダイクストラ法で始点nからの最短距離を得る if (n < 0 || n >= N) { return NULL; } ll* buf = new ll[N]; for (int i = 0; i < N; i++) { buf[i] = 1LL << 60; } // pair<重み, 番号>を並べておく set<pair<ll, int>> st; buf[n] = 0; st.insert({ 0, n }); while (st.empty() == false) { pair<ll, int> p = *st.begin(); st.erase(st.begin()); int k = p.second; if (p.first <= buf[k]) { for (auto itr = next[k].begin(); itr != next[k].end(); itr++) { if (buf[itr->first] > buf[k] + edge[itr->second].second) { buf[itr->first] = buf[k] + edge[itr->second].second; st.insert({ buf[itr->first], itr->first }); } } } } return buf; } ll* bellmanFord(int n) {// ベルマンフォード法で始点nからの最短距離を得る if (n < 0 || n >= N) { return NULL; } ll* buf = new ll[N]; for (int i = 0; i < N; i++) { buf[i] = 1LL << 60; } buf[n] = 0; for (int i = 0; i < N; i++) { int j = 0; for (auto itr = edge.begin(); itr != edge.end(); itr++, j++) { if (edgeActiveFlag[j] == false) { continue; } int x = itr->first.first, y = itr->first.second; ll w = itr->second; if (buf[y] > buf[x] + w) { buf[y] = buf[x] + w; if (i == N - 1) { return NULL; } } } } return buf; } ll* getDistanceFrom(int n) {// ある点からの最短距離の表を受け取る。 if (n < 0 || n >= N) { return NULL; } bool negativeFlag = false; { int i = 0; for (auto itr = edge.begin(); itr != edge.end(); itr++, i++) { if (edgeActiveFlag[i] == false) { continue; } if (itr->second < 0) { negativeFlag = true; break; } } } if (negativeFlag) {// 負の重みがあればベルマンフォード法 return bellmanFord(n); } else {// 全て非負ならダイクストラ法 return dijkstra(n); } } ll** getDistanceTable() {// 最短距離の表を受け取る。対角成分に非ゼロが含まれていたら、重み負の閉路が存在している。 ll** buf = new ll * [N]; for (int i = 0; i < N; i++) { buf[i] = new ll[N]; for (int j = 0; j < N; j++) { buf[i][j] = 1LL << 60; } buf[i][i] = 0; } bool flag = true; { int i = 0; for (auto itr = edge.begin(); itr != edge.end(); itr++, i++) { if (itr->second < 0) { flag = false; break; } } } if (flag) {// 全て0以上だったらダイクストラ法を使う for (int i = 0; i < N; i++) { ll* d = getDistanceFrom(i); for (int j = 0; j < N; j++) { buf[i][j] = d[j]; } delete[] d; } } else {// 負の重みが含まれていたらワーシャルフロイド法を使う for (int i = 0; i < N; i++) { for (auto itr = next[i].begin(); itr != next[i].end(); itr++) { buf[i][itr->first] = edge[itr->second].second; } } for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { for (int k = 0; k < N; k++) { buf[j][k] = min(buf[j][k], buf[j][i] + buf[i][k]); } } } } return buf; } void debugCout() {// デバッグ出力用 cout << endl; cout << "ノードの個数 = " << N << "個" << endl; cout << "エッジの本数 = " << M << "本" << endl; cout << endl; for (int i = 0; i < N; i++) { cout << "i = " << i << " (weight = " << weight[i] << "), 接続先 = "; if (next[i].size() == 0) { cout << "なし" << endl; continue; } auto itr = next[i].begin(); cout << itr->first << "(weight = " << itr->second << ")"; itr++; for (; itr != next[i].end(); itr++) { cout << ", " << itr->first << "(weight = " << itr->second << ")"; } cout << endl; } cout << endl; } bool directedFlag;// 有向グラフかどうか int N, M; ll* weight;// ノードの重み unordered_map<int, int>* next;// 各ノードからの行き先とエッジ番号 vector<pair<pair<int, int>, ll>> edge;// エッジ(頂点ペアと重み) vector<bool> edgeActiveFlag;// エッジが有効かどうか(removeを呼ぶとfalseに) }; void bfs(GraphClass& G, int root) {// 幅優先探索 int N = G.N; bool* visited = new bool[N]; for (int i = 0; i < N; i++) { visited[i] = (i == root); } queue<int> q; q.push(root); while (q.size() > 0) { int n = q.front(); q.pop(); visited[n] = true; // ここに各ノードで行う処理を書く for (auto itr = G.next[n].begin(); itr != G.next[n].end(); itr++) { // ここに各エッジで行う処理を書く if (visited[itr->first] == false) {// まだ訪れていなかったら q.push(itr->first); } } } delete[] visited; } bool* dfs_visited = NULL; void dfs_process_main(GraphClass& G, int n, int depth) {// 深さ優先探索 // ここに各ノードで行う処理を書く for (auto itr = G.next[n].begin(); itr != G.next[n].end(); itr++) { // ここに各エッジで行う処理を書く if (dfs_visited[itr->first] == false) {// まだ訪れていなかったら dfs_visited[itr->first] = true; dfs_process_main(G, itr->first, depth + 1); dfs_visited[itr->first] = false; } } } void dfs(GraphClass& G, int root) {// 深さ優先探索 int N = G.N; dfs_visited = new bool[N]; for (int i = 0; i < N; i++) { dfs_visited[i] = false; } dfs_visited[root] = true; dfs_process_main(G, root, 0); delete[] dfs_visited; dfs_visited = NULL; }
a.cc: In constructor 'UnionFindClass::UnionFindClass()': a.cc:9:26: error: 'NULL' was not declared in this scope 9 | parent = NULL; | ^~~~ a.cc:1:1: note: 'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' +++ |+#include <cstddef> 1 | ///////////// UnionFind a.cc: In destructor 'UnionFindClass::~UnionFindClass()': a.cc:13:31: error: 'NULL' was not declared in this scope 13 | if (parent != NULL) { | ^~~~ a.cc:13:31: note: 'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' a.cc:16:29: error: 'NULL' was not declared in this scope 16 | if (size != NULL) { | ^~~~ a.cc:16:29: note: 'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' a.cc: At global scope: a.cc:98:42: error: 'll' has not been declared 98 | inline void setNodeWeight(int n, ll weight) {// n番のノードの重みをweightに設定 | ^~ a.cc:108:43: error: 'll' has not been declared 108 | inline void addEdge(int x, int y, ll weight = 1) {// エッジ追加 | ^~ a.cc:195:9: error: 'll' does not name a type 195 | ll* dijkstra(int n) {// ダイクストラ法で始点nからの最短距離を得る | ^~ a.cc:226:9: error: 'll' does not name a type 226 | ll* bellmanFord(int n) {// ベルマンフォード法で始点nからの最短距離を得る | ^~ a.cc:252:9: error: 'll' does not name a type 252 | ll* getDistanceFrom(int n) {// ある点からの最短距離の表を受け取る。 | ^~ a.cc:275:9: error: 'll' does not name a type 275 | ll** getDistanceTable() {// 最短距離の表を受け取る。対角成分に非ゼロが含まれていたら、重み負の閉路が存在している。 | ^~ a.cc:345:9: error: 'll' does not name a type 345 | ll* weight;// ノードの重み | ^~ a.cc:346:9: error: 'unordered_map' does not name a type 346 | unordered_map<int, int>* next;// 各ノードからの行き先とエッジ番号 | ^~~~~~~~~~~~~ a.cc:347:9: error: 'vector' does not name a type 347 | vector<pair<pair<int, int>, ll>> edge;// エッジ(頂点ペアと重み) | ^~~~~~ a.cc:348:9: error: 'vector' does not name a type 348 | vector<bool> edgeActiveFlag;// エッジが有効かどうか(removeを呼ぶとfalseに) | ^~~~~~ a.cc: In constructor 'GraphClass::GraphClass()': a.cc:80:17: error: 'next' was not declared in this scope 80 | next = NULL; | ^~~~ a.cc:80:24: error: 'NULL' was not declared in this scope 80 | next = NULL; | ^~~~ a.cc:80:24: note: 'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' a.cc:81:17: error: 'weight' was not declared in this scope 81 | weight = NULL; | ^~~~~~ a.cc: In member function 'void GraphClass::activate(int, bool)': a.cc:89:17: error: 'edge' was not declared in this scope 89 | edge.clear(); | ^~~~ a.cc:90:17: error: 'edgeActiveFlag' was not declared in this scope 90 | edgeActiveFlag.clear(); | ^~~~~~~~~~~~~~ a.cc:92:21: error: 'next' was not declared in this scope 92 | if (next != NULL) { delete[] next; } | ^~~~ a.cc:92:29: error: 'NULL' was not declared in this scope 92 | if (next != NULL) { delete[] next; } | ^~~~ a.cc:92:29: note: 'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' a.cc:92:37: error: type '<type error>' argument given to 'delete', expected pointer 92 | if (next != NULL) { delete[] next; } | ^~~~~~~~~~~~~ a.cc:93:21: error: 'weight' was not declared in this scope 93 | if (weight != NULL) { delete[] weight; } | ^~~~~~ a.cc:93:31: error: 'NULL' was not declared in this scope 93 | if (weight != NULL) { delete[] weight; } | ^~~~ a.cc:93:31: note: 'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' a.cc:93:39: error: type '<type error>' argument given to 'delete', expected pointer 93 | if (weight != NULL) { delete[] weight; } | ^~~~~~~~~~~~~~~ a.cc:94:17: error: 'next' was not declared in this scope 94 | next = new unordered_map<int, int>[N]; | ^~~~ a.cc:94:28: error: 'unordered_map' does not name a type 94 | next = new unordered_map<int, int>[N]; | ^~~~~~~~~~~~~ a.cc:94:42: error: expected primary-expression before 'int' 94 | next = new unordered_map<int, int>[N]; | ^~~ a.cc:95:17: error: 'weight' was not declared in this scope 95 | weight = new ll[N]; | ^~~~~~ a.cc:95:30: error: 'll' does not name a type 95 | weight = new ll[N]; | ^~ a.cc: In member function 'void GraphClass::setNodeWeight(int, int)': a.cc:99:23: error: 'class GraphClass' has no member named 'weight' 99 | this->weight[n] = weight; | ^~~~~~ a.cc: In member function 'int GraphClass::getEdgeIndex(int, int)': a.cc:103:21: error: 'next' was not declared in this scope 103 | if (next[x].find(y) != next[x].end()) { | ^~~~ a.cc: In member function 'void GraphClass::addEdge(int, int, int)': a.cc:109:30: error: 'edge' was not declared in this scope 109 | int n = (int)edge.size(); | ^~~~ a.cc:111:17: error: 'edgeActiveFlag' was not declared in this scope 111 | edgeActiveFlag.push_back(true); | ^~~~~~~~~~~~~~ a.cc:113:17: error: 'next' was not declared in this scope 113 | next[x].insert({ y, n }); | ^~~~ a.cc: In member function 'void GraphClass::removeEdge(int, int)': a.cc:125:21: error: 'edge' was not declared in this scope 125 | x = edge[k].first.first; | ^~~~ a.cc:129:17: error: 'edgeActiveFlag' was not declared in this scope 129 | edgeActiveFlag[k] = false; | ^~~~~~~~~~~~~~ a.cc:131:17: error: 'next' was not declared in this scope 131 | next[x].erase(next[x].find(y)); | ^~~~ a.cc: In member function 'bool GraphClass::isTree()': a.cc:146:17: error: 'queue' was not declared in this scope 146 | queue<int> q; q.push(0); | ^~~~~ a.cc:146:23: error: expected primary-expression before 'int' 146 | queue<int> q; q.push(0); | ^~~ a.cc:146:31: error: 'q' was not declared in this scope 146 | queue<int> q; q.push(0); | ^ a.cc:152:41: error: 'next' was not declared in this scope 152 | for (auto itr = next[n].begin(); itr != next[n].end(); itr++) { | ^~~~ a.cc: In member function 'GraphClass* GraphClass::kruskal()': a.cc:171:17: error: 'vector' was not declared in this scope 171 | vector<pair<ll, pair<int, int>>> E; | ^~~~~~ a.cc:171:24: error: 'pair' was not declared in this scope 171 | vector<pair<ll, pair<int, int>>> E; | ^~~~ a.cc:171:29: error: 'll' was not declared in this scope 171 | vector<pair<ll, pair<int, int>>> E; | ^~ a.cc:171:38: error: expected primary-expression before 'int' 171 | vector<pair<ll, pair<int, int>>> E; | ^~~ a.cc:174:41: error: 'edge' was not declared in this scope 174 | for (auto itr = edge.begin(); itr != edge.end(); itr++, i++) { | ^~~~ a.cc:175:37: error: 'edgeActiveFlag' was not declared in this scope 175 | if (edgeActiveFlag[i] == false) { continue; } | ^~~~~~~~~~~~~~ a.cc:176:33: error: 'E' was not declared in this scope 176 | E.push_back({ itr->second, {itr->first.first, itr->first.second} }); | ^ a.cc:180:22: error: 'E' was not declared in this scope 180 | sort(E.begin(), E.end()); | ^ a.cc:180:17: error: 'sort' was not declared in this scope; did you mean 'short'? 180 | sort(E.begin(), E.end()); | ^~~~ | short a.cc:184:28: error: expected ';' before 'w' 184 | ll w = itr->first; | ^ a.cc:186:61: error: 'y' was not declared in this scope 186 | if (uf.getParent(x) != uf.getParent(y)) { | ^ a.cc:187:50: error: 'w' was not declared in this scope 187 | G->addEdge(x, y, w); | ^ a.cc: In member function 'void GraphClass::debugCout()': a.cc:323:17: error: 'cout' was not declared in this scope 323 | cout << endl; | ^~~~ a.cc:323:25: error: 'endl' was not declared in this scope 323 | cout <<
s589224254
p03724
C++
// https://ei1333.github.io/luzhiled/ // http://beet-aizu.hatenablog.com/entry/2017/01/04/113233 // http://www.prefield.com/algorithm/ #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vl = vector<ll>; using vd = vector<ld>; using vs = vector<string>; using vb = vector<bool>; #define pb push_back #define eb emplace_back #define fi first #define se second template<class T> using vc = vector<T>; template<class T> using vvc = vector<vector<T>>; using Graph = vector<vector<ll>>; const ll INF = 1LL << 60; void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);} #define tl 1'000'000'007 #define REP(i, n) for (ll i = 0; i < n; i++) #define REREP(i, n) for (ll i = n; i >= 0; i--) #define FOR(i, a, n) for (ll i = a; i < n; i++) #define REFOR(i, n, a) for (ll i = n; i >= a; i--) #define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除 #define debug cout << "line : " << __LINE__ << " debug" << endl; #define ini(...) int __VA_ARGS__; in(__VA_ARGS__) #define inl(...) long long __VA_ARGS__; in(__VA_ARGS__) #define ind(...) long double __VA_ARGS__; in(__VA_ARGS__) #define ins(...) string __VA_ARGS__; in(__VA_ARGS__) #define inc(...) char __VA_ARGS__; in(__VA_ARGS__) void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);} void out(){cout << endl;} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);} template<typename T>void die(T x){out(x); exit(0);} #define in1(A) REP(i,A.size()) in(A[i]); #define in2(A,B) REP(i,A.size()) in(A[i],B[i]); #define in3(s,t,u) REP(i,sz(s)){in(s[i] , t[i] , u[i]);} #define in4(s,t,u,v) REP(i,sz(s)){in(s[i] , t[i] , u[i] , v[i]);} #define each(x,v) for(auto& x : v) #define all(v) (v).begin(),(v).end() #define sz(v) ((int)(v).size()) struct Point{ ld x,y; }; ld dist(Point a, Point b){return sqrt(abs(a.x-b.x)*abs(a.x-b.x)+abs(a.y-b.y)*abs(a.y-b.y));} // 2点間の距離 ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; } ll lcm(ll a,ll b){ return a / gcd(a,b) * b;} ll fact(ll n){ if(n < 2) return 1; return (n * fact(n-1))%tl; } //階乗 inline ll updiv(ll a,ll b){ return (a + b - 1) / b; } //切り上げ template<typename T,typename U>ll ceil(T a,U b){return (a + b - 1) / b;} template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); } template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); } //------------------------------------------------------------------------------------------------- int main(){ init(); inl(n,m); // LCA(LowestCommonAncestor) map<ll,ll>T; REP(i,m){ inl(a,b); T[a]++; T[b]++; } ll f= 1; each(x,T){ if(x&1) f=0; } out(((f)?"YES":"NO")); }
a.cc: In function 'int main()': a.cc:65:13: error: no match for 'operator&' (operand types are 'std::pair<const long long int, long long int>' and 'int') 65 | if(x&1) f=0; | ~^~ | | | | | int | std::pair<const long long int, long long int> In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:4: /usr/include/c++/14/bitset:1557:5: note: candidate: 'template<long unsigned int _Nb> std::bitset<_Nb> std::operator&(const bitset<_Nb>&, const bitset<_Nb>&)' 1557 | operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/bitset:1557:5: note: template argument deduction/substitution failed: a.cc:65:14: note: 'std::pair<const long long int, long long int>' is not derived from 'const std::bitset<_Nb>' 65 | if(x&1) f=0; | ^ In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:65:14: note: 'std::pair<const long long int, long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 65 | if(x&1) f=0; | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:65:14: note: 'std::pair<const long long int, long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 65 | if(x&1) f=0; | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:65:14: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 65 | if(x&1) f=0; | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:65:14: note: 'std::pair<const long long int, long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 65 | if(x&1) f=0; | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:65:14: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 65 | if(x&1) f=0; | ^ /usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const valarray<_Tp>&, const valarray<_Tp>&)' 1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed: a.cc:65:14: note: 'std::pair<const long long int, long long int>' is not derived from 'const std::valarray<_Tp>' 65 | if(x&1) f=0; | ^ /usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed: a.cc:65:14: note: 'std::pair<const long long int, long long int>' is not derived from 'const std::valarray<_Tp>' 65 | if(x&1) f=0; | ^ /usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed: a.cc:65:14: note: mismatched types 'const std::valarray<_Tp>' and 'int' 65 | if(x&1) f=0; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:141:3: note: candidate: 'constexpr std::byte std::operator&(byte, byte)' 141 | operator&(byte __l, byte __r) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:141:18: note: no known conversion for argument 1 from 'std::pair<const long long int, long long int>' to 'std::byte' 141 | operator&(byte __l, byte __r) noexcept | ~~~~~^~~ In file included from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/bits/ios_base.h:84:3: note: candidate: 'constexpr std::_Ios_Fmtflags std::operator&(_Ios_Fmtflags, _Ios_Fmtflags)' 84 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:84:27: note: no known conversion for argument 1 from 'std::pair<const long long int, long long int>' to 'std::_Ios_Fmtflags' 84 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ios_base.h:134:3: note: candidate: 'constexpr std::_Ios_Openmode std::operator&(_Ios_Openmode, _Ios_Openmode)' 134 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:134:27: note: no known conversion for argument 1 from 'std::pair<const long long int, long long int>' to 'std::_Ios_Openmode' 134 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ios_base.h:181:3: note: candidate: 'constexpr std::_Ios_Iostate std::operator&(_Ios_Iostate, _Ios_Iostate)' 181 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:181:26: note: no known conversion for argument 1 from 'std::pair<const long long int, long long int>' to 'std::_Ios_Iostate' 181 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/bits/shared_ptr_atomic.h:33, from /usr/include/c++/14/memory:81, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56: /usr/include/c++/14/bits/atomic_base.h:109:3: note: candidate: 'constexpr std::memory_order std::operator&(memory_order, __memory_order_modifier)' 109 | operator&(memory_order __m, __memory_order_modifier __mod) noexcept | ^~~~~~~~ /usr/include/c++/14/bits/atomic_base.h:109:26: note: no known conversion for argument 1 from 'std::pair<const long long int, long long int>' to 'std::memory_order' 109 | operator&(memory_order __m, __memory_order_modifier __mod) noexcept | ~~~~~~~~~~~~~^~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176: /usr/include/c++/14/future:156:20: note: candidate: 'constexpr std::launch std::operator&(launch, launch)' 156 | constexpr launch operator&(launch __x, launch __y) noexcept | ^~~~~~~~ /usr/include/c++/14/future:156:37: note: no known convers
s241009943
p03724
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() // 昇順ソート #define rall(v) (v).rbegin(), (v).rend() // 降順ソート #define INF 1LL << 60 typedef long long int LL; typedef long long int ll; #define pll pair<ll, ll> #define F first #define S second const int MOD = 1000000007; 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 (a>b) { a=b; return true; } return false; } //sort(all(x))とするとソートできるよ // 10^x は pow(10,(x)) // 任意のlogは 対数の底の変換を使う log(N) / log(任意の底) int main(){ int N,M;cin >> N >> M; map<int,int> m; rep(i,M){ int a,b;cin >> a >> b; m[a]++; m[b]++; } bool ok = true; for(auto t : m){ if(t.S % 2 != 0)ok = false; } if(ok)cout << "Yes" < endl; else cout << "No" < endl; }
a.cc: In function 'int main()': a.cc:33:25: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>') 33 | if(ok)cout << "Yes" < endl; | ~~~~~~~~~~~~~~^~~~~~ 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:33:27: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 33 | if(ok)cout << "Yes" < endl; | ^~~~ /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:33:27: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 33 | if(ok)cout << "Yes" < endl; | ^~~~ /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:33:27: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 33 | if(ok)cout << "Yes" < endl; | ^~~~ /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:33:27: note: couldn't deduce template parameter '_Bi_iter' 33 | if(ok)cout << "Yes" < endl; | ^~~~ /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:33:27: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 33 | if(ok)cout << "Yes" < endl; | ^~~~ /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:33:27: note: couldn't deduce template parameter '_Bi_iter' 33 | if(ok)cout << "Yes" < endl; | ^~~~ /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:33:27: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 33 | if(ok)cout << "Yes" < endl; | ^~~~ 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:33:27: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 33 | if(ok)cout << "Yes" < endl; | ^~~~ 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:33:27: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 33 | if(ok)cout << "Yes" < endl; | ^~~~ /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:33:27: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 33 | if(ok)cout << "Yes" < endl; | ^~~~ /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:33:27: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 33 | if(ok)cout << "Yes" < endl; | ^~~~ /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:33:27: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 33 | if(ok)cout << "Yes" < endl; | ^~~~ 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:33:27: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 33 | if(ok)cout << "Yes" < endl; | ^~~~ /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:33:27: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 33 | if(ok)cout << "Yes" < endl; | ^~~~ /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:33:27: note: couldn't deduce template parameter '_CharT' 33 | if(ok)cout << "Yes" < endl; | ^~~~ /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:33:27: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 33 | if(ok)cout << "Yes" < endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT
s092294690
p03724
C++
#include <bits/stdc++.h> #define ll long long int #define MOD 1000000007 #define INF 1e18 #define PI 3.14159265358979 using namespace std; int main(void){ ll n, m; cin >> n >> m; vector<int> c(n); for (int i = 0; i < m; i++){ ll a, b; cin >> a >> b; a--; b--; c[a] = (c[a] + 1) % 2; c[b] = (c[b] + 1) % 2; } int ok = 1; for (int i = 0; i < n; i++){ if(c[a] == 1) ok = 0; } if(ok) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
a.cc: In function 'int main()': a.cc:24:10: error: 'a' was not declared in this scope 24 | if(c[a] == 1) | ^
s327236956
p03724
C++
#include<bits/stdc++.h> #include<unordered_set> #include<unordered_map> #include <algorithm> #include <iostream> #include <string> #include <cmath> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define FOR(i,a,b) for(ll i=(a);i<(b);i++) #define FORR(i,a,b)for(ll i=(a);i<=(b);i++) #define repR(i,n) for(ll i=n;i>=0;i--) #define all(v)(v).begin(),(v).end() #define rall(v)(v).rbegin(),(v).rend() #define F first #define S second #define pb push_back #define pu push #define COUT(x) cout<<(x)<<endl #define PQ priority_queue<ll> #define PQR priority_queue<ll,vector<ll>,greater<ll>> #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define mp make_pair #define maxs(x,y) (x = max(x,y)) #define mins(x,y) (x = min(x,y)) #define sz(x) (ll)(x).size() typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll MOD = 1000000007LL; const ll INF = 1LL << 60; using vll = vector<ll>; using vb = vector<bool>; using vvb = vector<vb>; using vvll = vector<vll>; using vstr = vector<string>; using pll = pair<ll, ll>; using vc = vector<char>; using vvc = vector<vc>; ll dx[4]={0,1,0,-1}; ll dy[4]={1,0,-1,0}; int main(){ ll n,m; cin>>n>>m; vll t(n); rep(i,m){ ll a,b; cin>>a>>b; a--; b--; t[a]++; t[b]++; } rep(i,n){ if(t[i]%2==1){ COUT("NO"); return 0; } } COUR("YES"); }
a.cc: In function 'int main()': a.cc:61:3: error: 'COUR' was not declared in this scope; did you mean 'COUT'? 61 | COUR("YES"); | ^~~~ | COUT
s433237070
p03724
C++
#include<bits/stdc++.h> using namespace std; int main(){ long N,M;cin>>N>>M; vector<long>A(N,0); for(long i=0;i<M;i++){ long a,b;cin>>a>>b;A[a-1]++;B[b-1]++; } bool a=1; for(long i=0;i<N;i++)a*=(A[i]%2==0); cout<<(a?"YES":"NO"); }
a.cc: In function 'int main()': a.cc:7:33: error: 'B' was not declared in this scope 7 | long a,b;cin>>a>>b;A[a-1]++;B[b-1]++; | ^
s494388748
p03724
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,m; scanf("%d%d}#include <bits/stdc++.h> using namespace std; int ct[100005]; int main(){ int n,m; scanf("%d%d",&n,&m); for (int i = 0; i < m; i++){ int x,y; scanf("%d%d",&x,&y); ct[x]++; ct[y]++; } for (int i = 1; i <= n; i++){ if (ct[i] & 1){ printf("NO"); return 0; } } printf("YES"); }
a.cc:5:9: warning: missing terminating " character 5 | scanf("%d%d}#include <bits/stdc++.h> | ^ a.cc:5:9: error: missing terminating " character 5 | scanf("%d%d}#include <bits/stdc++.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:6:1: error: expected primary-expression before 'using' 6 | using namespace std; | ^~~~~ a.cc:8:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 8 | int main(){ | ^~ a.cc:8:9: note: remove parentheses to default-initialize a variable 8 | int main(){ | ^~ | -- a.cc:8:9: note: or replace parentheses with braces to value-initialize a variable a.cc:8:11: error: a function-definition is not allowed here before '{' token 8 | int main(){ | ^ a.cc:25:2: error: expected '}' at end of input 25 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s983278634
p03724
C++
#include <bits/stdc++.h> using namespace std; typedef ll long long const int MAXN = 2e5 + 21; ll n, m; ll d[MAXN]; int main () { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n >> m ; while (m--) { ll v, u; cin >> v >> u; d[v]++; d[u]++; } for (int i = 1; i <= n ; i ++) if (d[i] % 2) return cout << "NO" << '\n', 0 ; cout << "YES" << '\n'; return 0; }
a.cc:4:9: error: 'll' does not name a type 4 | typedef ll long long | ^~ a.cc:8:1: error: 'll' does not name a type 8 | ll n, m; | ^~ a.cc:9:1: error: 'll' does not name a type 9 | ll d[MAXN]; | ^~ a.cc: In function 'int main()': a.cc:13:12: error: 'n' was not declared in this scope; did you mean 'yn'? 13 | cin >> n >> m ; | ^ | yn a.cc:13:17: error: 'm' was not declared in this scope; did you mean 'tm'? 13 | cin >> n >> m ; | ^ | tm a.cc:15:9: error: 'll' was not declared in this scope 15 | ll v, u; | ^~ a.cc:16:16: error: 'v' was not declared in this scope 16 | cin >> v >> u; | ^ a.cc:16:21: error: 'u' was not declared in this scope 16 | cin >> v >> u; | ^ a.cc:17:9: error: 'd' was not declared in this scope 17 | d[v]++; | ^ a.cc:21:13: error: 'd' was not declared in this scope 21 | if (d[i] % 2) | ^
s469331695
p03724
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,m; cin >>n >>m; int cnt[n+1]={}; for(int i=0;i<m;i++){ int a,b; cin >> a>>b; cnt[a]++; cnt[b]++; } for(i=0;i<=n;i++){ if(cnt[i]%2!=0){ cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:7: error: 'i' was not declared in this scope 15 | for(i=0;i<=n;i++){ | ^
s756654519
p03724
C++
to be coded
a.cc:1:1: error: 'to' does not name a type; did you mean 'auto'? 1 | to be coded | ^~ | auto
s903859445
p03724
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int cnt[100001]; int main(){ int n, m; cin >> n >> m; vector<int> ; for(int i = 0; i < m; ++i){ int a, b; cin >> a >> b; --a; --b; ++cnt[a]; ++cnt[b]; } for(int i = 0; i < n; ++i){ if(cnt[i] % 2 != 0){ cout << "NO\n"; return 0; } } cout << "YES\n"; }
a.cc: In function 'int main()': a.cc:12:5: error: declaration does not declare anything [-fpermissive] 12 | vector<int> ; | ^~~~~~~~~~~
s337549584
p03724
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<map> #include<set> #include<cstdio> #include<cmath> #include<numeric> #include<queue> #include<stack> #include<cstring> #include<limits> #include<functional> #define rep(i,a) for(int i=(int)0;i<(int)a;++i) #define pb push_back #define eb emplace_back using ll=long long; static const ll mod = 1e9 + 7; static const ll INF = 1LL << 50; using namespace std; ll graph[100005][100005]; int main(){ ll n,m; cin>>n>>m; vector<int>v(n,1); rep(i,m){ cin>>a>>b; a--;b--; v[a]=1-v[a]; v[b]=1-v[b]; } for(int x:v){ if(!x){ cout<<"NO"<<endl; return 0; } } cout<<"YES"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:30:14: error: 'a' was not declared in this scope 30 | cin>>a>>b; | ^ a.cc:30:17: error: 'b' was not declared in this scope 30 | cin>>a>>b; | ^
s170366795
p03724
C++
#include <iostream> #include <algorithm> #include <string> #include <vector> #include <cmath> #include <set> #include <map> #include <queue> using namespace std; #define rep(i,n) for(int i = 0;i<n;i++) const long long MOD = 1000000007LL; const string alpha = "abcdefghijklmnopqrstuvwxyz"; bool judge(long num[],long n){ rep(i,n){ if(num[i+1]%2==1) return false; } return true; } int main(){ long n,m; long >> n >> m; long num[n+1]; rep(i,n){ num[i+1]=0; } long a,b; rep(i,m){ cin >> a >> b; num[a]++; num[b]++; } if(judge(num,n)) cout << "YES" << endl; else cout << "NO" << endl; }
a.cc: In function 'int main()': a.cc:21:10: error: expected unqualified-id before '>>' token 21 | long >> n >> m; | ^~
s473858616
p03724
C++
#include <iostream> #include <cstring> #include <limits.h> #include <algorithm> #include <math.h> using namespace std; typedef long long ll; int main(void){ int n, m, x[100020]; cin >> n >> m; fill(x, x + n, 0); for (int i = 0; i < m; i++) { cin >> a >> b; a--; b--; x[a]++; x[b]++; } for (int i = 0; i < n; i++) { if (x[i] % 2 != 0) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; }
a.cc: In function 'int main()': a.cc:14:16: error: 'a' was not declared in this scope 14 | cin >> a >> b; | ^ a.cc:14:21: error: 'b' was not declared in this scope 14 | cin >> a >> b; | ^
s593031518
p03724
C++
#pragma once #include <sstream> #include <string> #include <vector> #include <map> #include <algorithm> #include <iostream> #include <utility> #include <set> #include <cctype> #include <queue> #include <stack> #include <cstdio> #include <cstdlib> #include <cmath> #include <deque> using namespace std; typedef long long ll; typedef pair<int, int> pii; int t[101]; int pri[26]; int res = 0; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } int pr[100010]; void uini(int n) { for (size_t i = 0; i <= n; i++) { pr[i] = i; } } int parent(int x) { if (x == pr[x]) return x; return pr[x] = parent(pr[x]); } bool unit(int x, int y) { int px = parent(x); int py = parent(y); if (px == py) return false; if (px < py) { pr[y] = px; } else { pr[x] = py; } return true; } struct edge { int to; bool use = false; edge(int _to) : to(_to) {} }; ll t[100010]; void solv() { ll n, m; cin >> n >> m; for (size_t i = 0; i < m; i++) { int a, b; cin >> a >> b; t[a]++; t[b]++; } for (size_t i = 1; i <= n; i++) { if (t[i] % 2 == 1) { cout << "NO" << endl; return; } } cout << "YES" << endl; } int main() { solv(); return 0; }
a.cc:1:9: warning: #pragma once in main file 1 | #pragma once | ^~~~ a.cc:59:4: error: conflicting declaration 'll t [100010]' 59 | ll t[100010]; | ^ a.cc:20:5: note: previous declaration as 'int t [101]' 20 | int t[101]; | ^
s890253464
p03724
C
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 100; int n, m, u, v, cnt[N]; int main() { ios::sync_with_stdio(false), cin.tie(0); cin >> n >> m; while(m--) { cin >> u >> v; cnt[--u]++; cnt[--v]++; } for (int i = 0; i < n; i++) if(cnt[i] & 1) { cout << "NO"; return 0; } cout << "YES"; return 0; }
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s294730377
p03724
C++
#include <bits/stdc++.h> using namespace std; int n,m,c[100005],a=0; int main(){ cin >> n >> m; m<<=1; while (m--) c[read()]^=1; for (int i=1;i<=n;i++) a+=c[i]; puts(a?"NO":"YES"); }
a.cc: In function 'int main()': a.cc:8:23: error: too few arguments to function 'ssize_t read(int, void*, size_t)' 8 | c[read()]^=1; | ~~~~^~ In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24, from /usr/include/signal.h:328, from /usr/include/c++/14/csignal:42, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116, from a.cc:1: /usr/include/unistd.h:371:16: note: declared here 371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur | ^~~~
s207350761
p03724
C++
#include <iostream> using namespace std; int main(){ int a,b,k[10005],l[100005]; cin>>a>>b; for(int i=0;i<b;++i){ cin>>k[i]>>l[i]; } for(int i=1;i<=a;++i){ int count=0; for(int j=0;j<b;++j){ if(k[j]==i||l[j]==i) count++; } if(count%2!=0){ cout<<"NO"<<endl; return 0; } } cout<<"YES"endl; }
a.cc: In function 'int main()': a.cc:19:9: error: unable to find string literal operator 'operator""endl' with 'const char [4]', 'long unsigned int' arguments 19 | cout<<"YES"endl; | ^~~~~~~~~
s722507793
p03724
C++
#include<cstdio> #include<iostream> #include<algorithm> using namespace std; int main() { int n,m; while(cin>>n>>m) { int a[100000],,c[100000]b[100000]={0}; for(int i=1;i<=n;i++) { cin>>a[i]>>c[i]; } int sum=0; for(int i=1;i<=n;i++) { b[a[i]]++; b[c[i]]++; } flag=1; for(int i=0;i<100000;i++) { if(b[i]%2!=0) flag=0; } if(flag==1) cout<<"YES"<<"\n"; else cout<<"NO\n" } }
a.cc: In function 'int main()': a.cc:10:31: error: expected unqualified-id before ',' token 10 | int a[100000],,c[100000]b[100000]={0}; | ^ a.cc:10:41: error: expected initializer before 'b' 10 | int a[100000],,c[100000]b[100000]={0}; | ^ a.cc:13:36: error: 'c' was not declared in this scope 13 | cin>>a[i]>>c[i]; | ^ a.cc:18:25: error: 'b' was not declared in this scope 18 | b[a[i]]++; | ^ a.cc:19:27: error: 'c' was not declared in this scope 19 | b[c[i]]++; | ^ a.cc:21:17: error: 'flag' was not declared in this scope 21 | flag=1; | ^~~~ a.cc:24:28: error: 'b' was not declared in this scope 24 | if(b[i]%2!=0) | ^ a.cc:30:29: error: expected ';' before '}' token 30 | cout<<"NO\n" | ^ | ; 31 | } | ~
s817176229
p03724
C++
#include<bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; using namespace std; #define pb push_back int dy[]={0, 0, 1, -1, 1, 1, -1, -1}; int dx[]={1, -1, 0, 0, 1, -1, -1, 1}; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define mp make_pair #define fi first #define sc second ll n; ll m; ll cou[200000]; int main(){ cin >> n >> m; REP(i,m) { ll a,b; cin >> a >> b; cou[a - 1]++; cou[b - 1]++; } REP(i,n) if(cou[i] % 2 == 1) { cout << "NO" << endl; return 0; } cout << "YES" << endl; return 0; } #include<bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; using namespace std; #define pb push_back int dy[]={0, 0, 1, -1, 1, 1, -1, -1}; int dx[]={1, -1, 0, 0, 1, -1, -1, 1}; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define mp make_pair #define fi first #define sc second ll n; ll m; ll cou[200000]; int main(){ cin >> n >> m; REP(i,m) { ll a,b; cin >> a >> b; cou[a - 1]++; cou[b - 1]++; } REP(i,n) if(cou[i] % 2 == 1) { cout << "NO" << endl; return 0; } cout << "YES" << endl; return 0; }
a.cc:42:5: error: redefinition of 'int dy []' 42 | int dy[]={0, 0, 1, -1, 1, 1, -1, -1}; | ^~ a.cc:6:5: note: 'int dy [8]' previously defined here 6 | int dy[]={0, 0, 1, -1, 1, 1, -1, -1}; | ^~ a.cc:43:5: error: redefinition of 'int dx []' 43 | int dx[]={1, -1, 0, 0, 1, -1, -1, 1}; | ^~ a.cc:7:5: note: 'int dx [8]' previously defined here 7 | int dx[]={1, -1, 0, 0, 1, -1, -1, 1}; | ^~ a.cc:52:4: error: redefinition of 'll n' 52 | ll n; | ^ a.cc:16:4: note: 'll n' previously declared here 16 | ll n; | ^ a.cc:53:4: error: redefinition of 'll m' 53 | ll m; | ^ a.cc:17:4: note: 'll m' previously declared here 17 | ll m; | ^ a.cc:54:4: error: redefinition of 'll cou [200000]' 54 | ll cou[200000]; | ^~~ a.cc:18:4: note: 'll cou [200000]' previously declared here 18 | ll cou[200000]; | ^~~ a.cc:55:5: error: redefinition of 'int main()' 55 | int main(){ | ^~~~ a.cc:19:5: note: 'int main()' previously defined here 19 | int main(){ | ^~~~
s128254750
p03724
C++
#include "stdafx.h" //ここから↓ #include <iostream> #include <climits> #include <stack> #include <queue> #include <string> #include <set> #include <map> #include <math.h> #include <algorithm> #include <vector> using namespace std; typedef long long ll; typedef pair<ll,ll> P; long long int INF = 1e18; double Pi = 3.141592653589; const int mod = 1000000007; // memset(a,0,sizeof(a)); →全部0にする vector<int> G[100005]; std::vector<P> tree[100010]; int dx[8]={1,0,-1,0,1,1,-1,-1}; int dy[8]={0,1,0,-1,1,-1,-1,1}; ll i,j,k,l,ii,jj; ll n,m; ll a,b; ll x[100005]; ll ans=0; ll v=-1,w; int main(){ cin>>n>>m; for(i=0;i<m;i++){ cin>>a>>b; x[a]++; x[b]++; } bool flag=false; for(i=1;i<=n;i++){ if(x[i]%2==1)flag=true; } if(flag)cout<<"NO"<<endl; else cout<<"YES"<<endl; return 0; }
a.cc:1:10: fatal error: stdafx.h: No such file or directory 1 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s893441048
p03724
C++
#include <iostream> #include <climits> #include <stack> #include <queue> #include <string> #include <set> #include <map> #include <math.h> #include <algorithm> #include <vector> using namespace std; typedef long long ll; typedef pair<ll,ll> P; long long int INF = 1e18; double Pi = 3.141592653589; const int mod = 1000000007; // memset(a,0,sizeof(a)); →全部0にする vector<int> G[100005]; std::vector<P> tree[100010]; int dx[8]={1,0,-1,0,1,1,-1,-1}; int dy[8]={0,1,0,-1,1,-1,-1,1}; ll i,j,k,l,ii,jj; ll n,m; ll a,b ll ans=0; ll v=-1,w; int main(){ cin>>n>>m; for(i=0;i<m;i++){ cin>>a>>b; ans += abs(b-a); } if(ans%2==0)cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }
a.cc:31:1: error: expected initializer before 'll' 31 | ll ans=0; | ^~ a.cc: In function 'int main()': a.cc:38:25: error: 'b' was not declared in this scope 38 | cin>>a>>b; | ^ a.cc:39:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 39 | ans += abs(b-a); | ^~~ | abs a.cc:41:12: error: 'ans' was not declared in this scope; did you mean 'abs'? 41 | if(ans%2==0)cout<<"YES"<<endl; | ^~~ | abs
s068865691
p03724
C++
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define MAX 100005 int vis[MAX]; int main() { int n,m; scanf("%d%d",&n,&m); memset(vis,0,sizeof(vis)); while(m--) { scanf("%d%d",&x,&y); vis[x]++; vis[y]++; } int flag=1; for(int i=1;i<=n;i++) if(vis[i]%2) flag=0; if(flag) printf("YES\n"); else printf("NO\n"); return 0; }
a.cc: In function 'int main()': a.cc:15:23: error: 'x' was not declared in this scope 15 | scanf("%d%d",&x,&y); | ^ a.cc:15:26: error: 'y' was not declared in this scope 15 | scanf("%d%d",&x,&y); | ^
s471892309
p03724
C++
#include<cstdio> int n, m, x, y, ans = 0; int main() { scanf(%d%d", &n, &m); for(int i = 0; i < m; i++) { scanf("%d%d", &x, &y); ans ^= x ^ y; } if(!ans) printf("YES\n"); else printf("NO\n"); return 0; }
a.cc:6:15: warning: missing terminating " character 6 | scanf(%d%d", &n, &m); | ^ a.cc:6:15: error: missing terminating " character 6 | scanf(%d%d", &n, &m); | ^~~~~~~~~~~ a.cc: In function 'int main()': a.cc:6:11: error: expected primary-expression before '%' token 6 | scanf(%d%d", &n, &m); | ^ a.cc:6:12: error: 'd' was not declared in this scope 6 | scanf(%d%d", &n, &m); | ^ a.cc:7:20: error: 'i' was not declared in this scope 7 | for(int i = 0; i < m; i++) | ^
s327707916
p03724
C++
#include <iostream> using namespace std; int main() { int N, M; cin >> N >> M; int tmp = N; int v[10000] = { 0 }; while (tmp--) { int a, b; cin >> a >> b; v[a - 1] ^= 1; v[b - 1] ^= 1; } for (int i = 0; i < ; i++) { if (v[i] % 2) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 1; }
a.cc: In function 'int main()': a.cc:17:25: error: expected primary-expression before ';' token 17 | for (int i = 0; i < ; i++) | ^
s272184845
p03724
C++
#include<iostream> using namespace std; int main() { int n, m, x, y; bool flag = true; int sw[100000]; memset(sw, 0, sizeof(sw)); cin >> n >> m; for (int i = 0; i < m; i++) { cin >> x >> y; sw[x] += 1; sw[y] += 1; } for (int i = 0; i < 100000; i++) { if (sw[i] % 2 == 1) { flag = false; break; } } if (flag == true) { cout << "YES" << endl; } else { cout << "NO" << endl; } }
a.cc: In function 'int main()': a.cc:7:9: error: 'memset' was not declared in this scope 7 | memset(sw, 0, sizeof(sw)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 | using namespace std;
s936762683
p03724
C++
#include<iostream> using namespace std;   int n, m, x, y; int a[100005]={0};   int main(){ cin>>n>>m; for(int i=1; i<=m; i++){ cin>>x>>y; a[x]++; a[y]++; } for(int i=1; i<=n; i++){ if(a[i]%2){ cout<<"NO"; return 0; } } cout<<"YES"; return 0; }
a.cc:4:1: error: extended character   is not valid in an identifier 4 |   | ^ a.cc:7:1: error: extended character   is not valid in an identifier 7 |   | ^ a.cc:4:1: error: '\U000000a0' does not name a type 4 |   | ^ a.cc:7:1: error: '\U000000a0' does not name a type 7 |   | ^
s505355103
p03724
C++
#include<iostream> using namespace std;   int n, m, x, y; int a[100005];   int main(){ cin>>n>>m; for(int i=1; i<=m; i++){ cin>>x>>y; a[x]++; a[y]++; } for(int i=1; i<=n; i++){ if(a[i]%2){ cout<<"NO"; return 0; } } cout<<"YES"; return 0; }
a.cc:4:1: error: extended character   is not valid in an identifier 4 |   | ^ a.cc:7:1: error: extended character   is not valid in an identifier 7 |   | ^ a.cc:4:1: error: '\U000000a0' does not name a type 4 |   | ^ a.cc:7:1: error: '\U000000a0' does not name a type 7 |   | ^
s146861408
p03724
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; typedef vector<pair<int, int> > vp; #define pb push_back #define rep(i, a, n) for(int i = (a); i < (n); i++) #define dep(i, a, n) for(int i = (a); i >= (n); i--) #define out(n) cout << (n) << endl; #define vut(v) rep(i, v.size()) out(v[i]); int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m, d[100001] = {0}; cin >> n >> m; int a, b; rep(i, m) { cin >> a >> b; d[a]++, d[b]++; } rep(i, n + 1) { if(d[i] & 1) { out("NO") return 0; } } out("YES") }
a.cc:23:11: error: macro "rep" requires 3 arguments, but only 2 given 23 | rep(i, m) { | ^ a.cc:11:9: note: macro "rep" defined here 11 | #define rep(i, a, n) for(int i = (a); i < (n); i++) | ^~~ a.cc:28:15: error: macro "rep" requires 3 arguments, but only 2 given 28 | rep(i, n + 1) { | ^ a.cc:11:9: note: macro "rep" defined here 11 | #define rep(i, a, n) for(int i = (a); i < (n); i++) | ^~~ a.cc: In function 'int main()': a.cc:23:3: error: 'rep' was not declared in this scope 23 | rep(i, m) { | ^~~ a.cc:28:6: error: expected ';' before '{' token 28 | rep(i, n + 1) { | ^ ~ | ;
s297088706
p03724
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; typedef vector<pair<int, int> > vp; #define pb push_back #define rep(i, n) for(int i = 0; i < (n); i++) #define For(i, a, n) for(int i = a; i < (n); i++) #define out(n) cout << (n) << endl; #define vut(v) rep(i, v.size()) out(v[i]); int main() { int n, m, d[10001]; cin >> n >> m; int a, b; rep(i, m) { cin >> a >> b; d[a] ^= 1, d[b] ^= 1; } For(i, 1, n + 1) { if(d[i] == 1) { out("NO") return; } } out("YES") }
a.cc: In function 'int main()': a.cc:29:7: error: return-statement with no value, in function returning 'int' [-fpermissive] 29 | return; | ^~~~~~
s099476950
p03724
C++
#include <iostream> #include <sstream> #include <vector> #include <cmath> #include <ctime> #include <cassert> #include <ctype.h> #include <iomanip> #include <cstdio> #include <float.h> #include <queue> #include <set> #include <map> #include <fstream> #include <cstdlib> #include <string> #include <cstring> #include <algorithm> #include <numeric> #include <stack> #include <functional> // #include <pair> using namespace std; #define endl '\n' #define MOD 1000000007 #define INF 1ll<<30 // #define MAX 100010 #define eps 1e-11 #define bit_max 1ll<<32 #define _USE_MATH_DEFINES // long long binpow(long long a,long long b) // { // if (b == 1) return a; // long long res = binpow(a, b/2)%MOD; // if (b % 2) return (res*((res*a)%MOD))%MOD; // else return (res * res)%MOD; // } // long long int fact(long long int a) // { // if(a==0||a==1) // return 1; // long long int ans = 1; // for(int i=a;i>=1;i--) // ans = (ans * i); // return ans; // } // long long int ivmod(long long int a) // { // return binpow(a,MOD-2); // } // long long int ncr(long long int a,long long int b) // { // long long int pans=1; // for(int i =a;i>max(b,a-b);i--) // pans=pans*i; // long long int div = fact(min(b,a-b)); // // cout<<ans<<" "<<div<<endl; // pans = pans/div; // return pans; // } int count[100005]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); // cout.tie(NULL); // #ifndef ONLINE_JUDGE // freopen("input.txt","r",stdin); // freopen("output.txt","w",stdout); // #endif int n,m; cin>>n>>m; for(int i=0;i<m;i++) { int x,y; cin>>x>>y; count[x]++; count[y]++; } for(int i=1;i<=n;i++) { if(count[i]%2!=0) { cout<<"NO"<<endl; return 0; } } cout<<"YES"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:87:9: error: reference to 'count' is ambiguous 87 | count[x]++; | ^~~~~ In file included from /usr/include/c++/14/algorithm:86, from a.cc:18: /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)' 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~ In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)' 4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value) | ^~~~~ a.cc:70:5: note: 'int count [100005]' 70 | int count[100005]; | ^~~~~ a.cc:88:9: error: reference to 'count' is ambiguous 88 | count[y]++; | ^~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)' 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~ /usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)' 4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value) | ^~~~~ a.cc:70:5: note: 'int count [100005]' 70 | int count[100005]; | ^~~~~ a.cc:92:12: error: reference to 'count' is ambiguous 92 | if(count[i]%2!=0) | ^~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)' 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~ /usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)' 4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value) | ^~~~~ a.cc:70:5: note: 'int count [100005]' 70 | int count[100005]; | ^~~~~
s007779129
p03724
C++
#include<iostream> int temp[100001]; using namespace std; int main(){ int m,n; bool result=true; while(cin>>n>>m){ result=true; for(int i=0;i<n+1;i++){ temp[i]=0; } int a,b; for(int j=0;j<m;j++){ cin>>a>>b; temp[a]++; temp[b]++; } for(int k=1;k<n;k++){ if(temp[k] != temp[k+1] || temp[k]<1) result=false; } if(result && temp[k] > 1 && temp[1]%2==0) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:24:35: error: 'k' was not declared in this scope 24 | if(result && temp[k] > 1 && temp[1]%2==0) cout<<"YES"<<endl; | ^
s855940753
p03724
C++
#include<cstdio> #include<cstring> #include<cstdlib> #include<map> #include<set> #include<algorithm> #include<cmath> using namespace std; map<int,int>s[100005]; int main(){ int n,m; memset(s,0,sizeof(s)); scanf("%d %d",&n,&m); for(int i = 1;i <= m;i++){ int a,b; scanf("%d %d",a,b); s[a]++; s[b]++; } for(int i = 1;i <= n;i++){ if(s[i] % 2 != 0){ printf("NO"); return 0; } } printf("YES"); }
a.cc: In function 'int main()': a.cc:19:21: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 19 | s[a]++; | ~~~~^~ a.cc:20:21: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 20 | s[b]++; | ~~~~^~ a.cc:23:25: error: no match for 'operator%' (operand types are 'std::map<int, int>' and 'int') 23 | if(s[i] % 2 != 0){ | ~~~~ ^ ~ | | | | | int | std::map<int, int>
s591463316
p03724
C++
#include<cstdio> #include<cstring> #include<cstdlib> #include<map> #include<set> #include<algorithm> #include<cmath> using namespace std; map<int,int>s[100005]; int main(){ int n,m; memset(s,0,sizeof(s)); scanf("%d %d",&n,&m); for(int i = 1;i <= m;i++){ int a,b; scanf("%d %d",a,b); s[a]++; s[b]++; } for(int i = 1;i <= n;i++){ if(s[i] % 2 != 0){ printf("NO"); return 0; } } printf("YES"); }
a.cc: In function 'int main()': a.cc:19:21: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 19 | s[a]++; | ~~~~^~ a.cc:20:21: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 20 | s[b]++; | ~~~~^~ a.cc:23:25: error: no match for 'operator%' (operand types are 'std::map<int, int>' and 'int') 23 | if(s[i] % 2 != 0){ | ~~~~ ^ ~ | | | | | int | std::map<int, int>
s264199627
p03724
C
#include <cstdio> #include <set> std::set<int> e[100000]; int num; bool path(int a, int b, int p){ if(a==b) return true; for(auto c: e[a]){ if(c == p) continue; if(path(c, b, a)){ e[a].erase(c); e[c].erase(a); num--; return true; } } return false; } int main(){ int n, m; scanf("%d%d", &n, &m); int r = 0; for(int i=0;i<m;i++){ int a, b; scanf("%d%d", &a, &b); if(!path(a-1, b-1, -1)){ e[a-1].insert(b-1); e[b-1].insert(a-1); num++; } } if(num) puts("NO"); else puts("YES"); return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s847672818
p03724
C++
N, M = map(int, input().split()) deg = [0 for i in range(N)] for i in range(M): a, b = map(int, input().split()) deg[a-1] += 1 deg[b-1] += 1 res = 'YES' for d in deg: if d % 2 == 1: res = 'NO' print(res)
a.cc:8:7: warning: multi-character character constant [-Wmultichar] 8 | res = 'YES' | ^~~~~ a.cc:11:15: warning: multi-character character constant [-Wmultichar] 11 | res = 'NO' | ^~~~ a.cc:1:1: error: 'N' does not name a type 1 | N, M = map(int, input().split()) | ^
s289293676
p03724
C++
N, M = map( int, input().split() ) imos = [ 0 for i in range( N + 1 ) ] for i in range( M ): a, b = map( int, input().split() ) imos[ a - 1 ] += 1 imos[ b - 1 ] -= 1 for i in range( 1, N ): imos[ i ] += imos[ i - 1 ] print( "NO" if any( imos[ i ] & 1 for i in range( N ) ) else "YES" )
a.cc:1:1: error: 'N' does not name a type 1 | N, M = map( int, input().split() ) | ^
s810489668
p03724
C++
#include<iostream> #include<algorithm> #include<string> using namespace std; int n,m,a,b; int cnt[100010]; int main(){ cin>>n>>m; memset(cnt,0,n); for(int i=0;i<m;i++){ cin>>a>>b; cnt[a]++,cnt[b]++; } bool ok=true; for(int i=0;i<=n;i++){ if(cnt[i]%2==1)ok=false; } if(ok)cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:9:9: error: 'memset' was not declared in this scope 9 | memset(cnt,0,n); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<algorithm> +++ |+#include <cstring> 3 | #include<string>
s554646104
p03725
C++
#include <bits/stdc++.h> #define LL long long #define PII pair #define MP(x, y) make_pair((x),(y)) #define fi first #define se second #define PB(x) push_back((x)) #define MMG(x) memset((x), -1,sizeof(x)) #define MMF(x) memset((x),0,sizeof(x)) #define MMI(x) memset((x), INF, sizeof(x)) using namespace std; const int INF = 0x3f3f3f3f; const int N = 1e5+20; const double eps = 1e-8; char mp[1000][1000]; int dir[4][2] = {1, 0, -1, 0, 0, 1, 0, -1}; int vis[1000][1000]; int n, m, k; int bfs(int sx, int sy) { MMF(vis); int ans = INF; queueq; q.push(MP(sx, sy)); while(!q.empty()) { PII nw = q.front(); q.pop(); int sp = min(min(nw.fi - 1, nw.se - 1), min(n - nw.fi , m - nw.se)); ans = min(sp / k + ((sp%k)?1:0), ans); for(int i = 0; i < 4; i++) { int nx = nw.fi + dir[i][0]; int ny = nw.se + dir[i][1]; if(nx > 0 && ny > 0 && nx <= n && ny <= m && mp[nx][ny] == '.') { if(!vis[nx][ny] && abs(nx - sx) + abs(ny - sy) <= k) vis[nx][ny] = 1, q.push(MP(nx, ny)); } } } return ans; } int main() { while(cin >> n >> m >> k) { getchar(); int sx = -1, sy = -1; for(int i = 1; i <= n; i++) { for(int j = 1; j <= m; j++) { scanf("%c",&mp[i][j]); if(mp[i][j] == 'S') sx = i, sy = j; } getchar(); } int ans = bfs(sx, sy); printf("%d\n", ans + 1); } return 0; }
a.cc: In function 'int bfs(int, int)': a.cc:25:5: error: 'queueq' was not declared in this scope 25 | queueq; | ^~~~~~ a.cc:26:5: error: 'q' was not declared in this scope 26 | q.push(MP(sx, sy)); | ^
s212288015
p03725
C++
#include <iostream> #include <vector> #include <queue> #include <algorithm> #include "../../library/library/debug_template.cpp" using namespace std; #ifdef _DEBUG #include "../../library/library/debug_template.cpp" #define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__) #else #define DMP(...) ((void)0) #endif struct init { init() { cin.tie(nullptr); ios::sync_with_stdio(false); } } init_; int main() { int h, w, k; cin >> h >> w >> k; vector<vector<char>> grid(h, vector<char>(w)); int si, sj; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cin >> grid[i][j]; if (grid[i][j] == 'S') { si = i; sj = j; } } } using type = pair<int, pair<int, int>>; priority_queue<type, vector<type>, greater<type>> pq; vector<vector<int>> cost(h, vector<int>(w, 1e9)); pq.emplace(0, make_pair(si, sj)); while (!pq.empty()) { auto [c, xy] = pq.top(); auto [x, y] = xy; pq.pop(); if (cost[x][y] <= c) continue; DMP(c, xy); cost[x][y] = c; vector<int> dx{ 1,-1,0,0 }; vector<int> dy{ 0,0,1,-1 }; for (int i = 0; i < 4; i++) { int nx = x + dx[i], ny = y + dy[i]; if (nx < 0 || nx >= h || ny < 0 || ny >= w) continue; if (cost[nx][ny] <= c) continue; if (grid[x][y] == 'S' || grid[x][y] != grid[nx][ny]) { pq.emplace((c / k + 1) * k, make_pair(nx, ny)); } else pq.emplace(c + 1, make_pair(nx, ny)); } } DMP(cost); int ans = 1e9; for (int i = 0; i < h; i++) { ans = min(ans, (cost[i][0] + 1) / k + (grid[i][0] == '#')); ans = min(ans, (cost[i][w - 1] + 1) / k + (grid[i][w - 1] == '#')); } for (int j = 0; j < w; j++) { ans = min(ans, (cost[0][j] + 1) / k + (grid[0][j] == '#')); ans = min(ans, (cost[h - 1][j] + 1) / k + (grid[h - 1][j] == '#')); } cout << ans << endl; }
a.cc:6:10: fatal error: ../../library/library/debug_template.cpp: No such file or directory 6 | #include "../../library/library/debug_template.cpp" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s034881959
p03725
C++
int H,W,K; string S[808]; int SY,SX; int dist[808][808]; void solve() { int i,j,k,l,r,x,y; string s; cin>>H>>W>>K; FOR(y,H) { cin>>S[y]; FOR(x,W) { if(S[y][x]=='S') { S[y][x]='.'; SY=y; SX=x; } dist[y][x]=1<<20; } } dist[SY][SX]=0; queue<int> Q; Q.push(SY*1000+SX); int mi=1<<20; while(Q.size()) { int cy=Q.front()/1000; int cx=Q.front()%1000; Q.pop(); mi=min(mi,1+(cy+K-1)/K); mi=min(mi,1+(cx+K-1)/K); mi=min(mi,1+((H-1-cy)+K-1)/K); mi=min(mi,1+((W-1-cx)+K-1)/K); if(dist[cy][cx]==K) continue; FOR(i,4) { int dd[]={1,0,-1,0}; int ty=cy+dd[i]; int tx=cx+dd[i^1]; if(ty<0 || tx<0 || ty>=H || tx>=W) continue; if(S[ty][tx]=='#') continue; if(dist[ty][tx]>dist[cy][cx]+1) { dist[ty][tx]=dist[cy][cx]+1; Q.push(ty*1000+tx); } } } cout<<mi<<endl; }
a.cc:2:1: error: 'string' does not name a type 2 | string S[808]; | ^~~~~~ a.cc: In function 'void solve()': a.cc:8:28: error: 'string' was not declared in this scope 8 | int i,j,k,l,r,x,y; string s; | ^~~~~~ a.cc:10:9: error: 'cin' was not declared in this scope 10 | cin>>H>>W>>K; | ^~~ a.cc:11:9: error: 'FOR' was not declared in this scope 11 | FOR(y,H) { | ^~~ a.cc:24:9: error: 'queue' was not declared in this scope 24 | queue<int> Q; | ^~~~~ a.cc:24:15: error: expected primary-expression before 'int' 24 | queue<int> Q; | ^~~ a.cc:25:9: error: 'Q' was not declared in this scope 25 | Q.push(SY*1000+SX); | ^ a.cc:33:20: error: 'min' was not declared in this scope; did you mean 'mi'? 33 | mi=min(mi,1+(cy+K-1)/K); | ^~~ | mi a.cc:51:9: error: 'cout' was not declared in this scope 51 | cout<<mi<<endl; | ^~~~ a.cc:51:19: error: 'endl' was not declared in this scope 51 | cout<<mi<<endl; | ^~~~
s730108716
p03725
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define fi first #define se second #define sz size() #define bgn begin() #define en end() #define pb push_back #define pp() pop_back() #define V vector #define P pair #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(),a.end()),a.end()) #define Q queue #define pri priority_queue #define Pri priority_queue<int,vector<int>,greater<int>> #define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>> #define ff first.first #define fs first.second #define sf second.first #define ss second.second #define all(a) (a).begin(),(a).end() #define elif else if int low(V<int> &a,int b){ auto c=lower_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } int upp(V<int> &a,int b){ auto c=upper_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } template<class T> void cou(vector<vector<T>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } } int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } int gcm(int a,int b){ if(a%b==0) return b; return gcm(b,a%b); } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; for(int i=3;i<=sqrt(a)+1;i+=2){ if (a%i==0) return false; } return true; } struct Union{ vector<int> par; Union(int a){ par=vector<int>(a,-1); } int find(int a){ if(par[a]<0) return a; else return par[a]=find(par[a]); } bool same(int a,int b){ return find(a)==find(b); } int Size(int a){ return -par[find(a)]; } void unite(int a,int b){ a=find(a); b=find(b); if(a==b) return; if(Size(b)>Size(a)) swap<int>(a,b); par[a]+=par[b]; par[b]=a; } }; int ketas(int a){ string b=to_string(a); int c=0; fo(i,keta(a)){ c+=b[i]-'0'; } return c; } bool fe(int a,int b){ a%=10; b%=10; if(a==0) a=10; if(b==0) b=10; if(a>b) return true; else return false; } int INF=1000000007; struct edge{int s,t,d; }; V<int> mojisyu(string a){ V<int> b(26,0); fo(i,a.sz){ b[a[i]-'a']++; } return b; } int wa2(int a){ if(a%2==1) return a/2; return a/2-1; } /*signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } } ?*/ int nCr(int n,int r){ int a=1; r=min(r,n-r); for(int i=n;i>n-r;i--){ a*=i; a/=n-i+1; } return a; } /*void sea(int x,int y){ if(x<0||a<=x||y<0||b<=y||c[x][y]=='#') return; if(d[x][y]) return; d[x][y]++; sea(x+1,y); sea(x-1,y); sea(x,y+1); sea(x,y-1); }*/ int kaijou(int a){ int b=1; fo(i,a) b*=i+1; return b; } int nPr(int a,int b){ if(a<b) return 0; if(b==0) return 1; int c=1; for(int i=a;i>a-b;i--){ c*=i; c%=INF; } return c; } long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } // a^{-1} mod を計算する long long modinv(long long a, long long mod) { return modpow(a, mod - 2, mod); } int lcm(int a,int b){ int c=modinv(gcm(a,b),INF); return ((a*c)%INF)*(b%INF)%INF; } int MOD=INF; int fac[1000010], finv[1000010], inv[1000010]; // テーブルを作る前処理 //先にCOMinit()で前処理をする //ABC145D void COMinit() { fac[0]=fac[1]=1; finv[0]=finv[1]=1; inv[1]=1; for(int i=2;i<1000010;i++){ fac[i]=fac[i-1]*i%MOD; inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD; finv[i]=finv[i-1]*inv[i]%MOD; } } // 二項係数計算 int COM(int n,int k){ if(n<k) return 0; if(n<0||k<0) return 0; return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD; } bool naka(int a,int b,V<V<char>> c){ return (a>=0&&b>=0&&a<c.sz&&b<c[0].sz); } V<P<int,int>> mawari8={{0,-1},{0,1},{1,0},{-1,0},{-1,-1},{1,1},{1,-1},{-1,-1}}; int inf=1000000000000000007; V<P<int,int>> mawari4={{0,-1},{0,1},{1,0},{-1,0}}; //最短経路の表 a(全部INFで初期化) //縦横 x,y //迷路 f //スタートsx,sy //ゴールgx,gy //文字はgから使おうね /*int bfs_haba(){ Q<P<int,int>> b; a[sx][sy]=0; b.push({sx,sy}); while(!b.empty()){ P<int,int> c=b.front(); b.pop(); if(c.fi==gx&&c.se==gy){ break; } fo(i,4){ int d=c.fi+mawari4[i].fi; int e=c.se+mawari4[i].se; if(0<=d&&0<=e&&d<x&&e<y&&f[d][e]!='#'&&a[d][e]==INF){ b.push({d,e}); a[d][e]=1+a[c.fi][c.se]; } } } return a[gx][gy]; }*/ V<int> onajibubun(string a){ V<int> b(a.sz); for(int i=1,j=0;i<a.sz;i++){ if(i+b[i-j]<j+b[j]) b[i]=b[i-j]; else{ int c=max<int>(0,j+b[j]-i); while(i+c<a.sz&&a[c]==a[i+c]) c++; b[i]=c; j=i; } } b[0]=a.sz; return b; } //各頂点ごとにどこに辺が出てるかの表がc //各頂点ごとの色を表すV<int>(頂点数max)のcolorを用意する //aはどこ塗るか、bは何で塗るかなので、(0,1,c)でよぶとおけ V<int> color(200005); bool nibu_hantei(int a,int b,V<V<int>> c){ color[a]=b; fo(i,c[a].sz){ if(b==color[c[a][i]]) return false; if(color[c[a][i]]==0&&!nibu_hantei(c[a][i],-b,c)) return false; } return true; } //aは頂点数 //nibu_hanteiの上にcolorを用意する //各頂点ごとにどこに辺が出てるかの表がc bool renketujanai_nibu_hantei(int a,V<V<int>> c){ fo(i,a){ if(color[i]==0){ if(!nibu_hantei(i,1,c)) return false; } } return true; } struct segmin{ vector<int> seg; int b; segmin(V<int> a){ b=1; while(b<a.sz) b*=2; seg=vector<int>(2*b-1,inf); fo(i,a.sz){ seg[i+b-1]=a[i]; } for(int i=b-2;i>=0;i--){ seg[i]=min(seg[2*i+1],seg[2*i+2]); } } void update(int i,int a){ i+=b-1; seg[i]=a; while(i){ i=(i-1)/2; seg[i]=min(seg[2*i+1],seg[2*i+2]); } } //最初呼び出すときは要求区間x,y+1(yは添え字+1)とa=0,l=0,r=INFで //l,rは探すところ int getmin(int x,int y,int a,int l,int r){ if(r==INF) r=b; if(r<=x||y<=l) return INF; if(x<=l&&r<=y) return seg[a]; int a1=getmin(x,y,2*a+1,l,(l+r)/2); int a2=getmin(x,y,2*a+2,(l+r)/2,r); return min(a1,a2); } }; struct segadd{ vector<int> seg; int b; segadd(V<int> a){ b=1; while(b<a.sz) b*=2; seg=vector<int>(2*b-1,0); fo(i,a.sz){ seg[i+b-1]=a[i]; } for(int i=b-2;i>=0;i--){ seg[i]=seg[2*i+1]+seg[2*i+2]; } } void update(int i,int a){ i+=b-1; seg[i]=a; while(i){ i=(i-1)/2; seg[i]=seg[2*i+1]+seg[2*i+2]; } } //最初呼び出すときは要求区間x,y+1(yは添え字+1)とa=0,l=0,r=INFで //l,rは探すところ int getadd(int x,int y,int a,int l,int r){ if(r==INF) r=b; if(r<=x||y<=l) return 0; if(x<=l&&r<=y) return seg[a]; int a1=getadd(x,y,2*a+1,l,(l+r)/2); int a2=getadd(x,y,2*a+2,(l+r)/2,r); return a1+a2; } }; struct sege{ vector<P<int,V<int>>> seg; int b; sege(string a){ b=1; while(b<a.sz) b*=2; seg=vector<P<int,V<int>>>(2*b-1); fo(i,a.sz){ seg[i+b-1].fi=1; seg[i+b-1].se.pb(a[i]-'a'); } for(int i=b-2;i>=0;i--){ V<int> d=seg[2*i+1].se; fo(j,seg[2*i+2].se.sz){ d.pb(seg[2*i+2].se[j]); } Sort(d); uni(d); seg[i].se=d; seg[i].fi=d.sz; } } V<int> mu; void update(int i,char a){ i+=b-1; seg[i].se=mu; seg[i].se.pb(a-'a'); seg[i].fi=1; while(i){ i=(i-1)/2; V<int> d=seg[2*i+1].se; fo(j,seg[2*i+2].se.sz){ d.pb(seg[2*i+2].se[j]); } Sort(d); uni(d); seg[i].se=d; seg[i].fi=d.sz; } } void unko(){ fo(i,2*b-1) cout<<seg[i].fi<<' '; } //最初呼び出すときは要求区間x,y+1(yは添え字+1)とa=0,l=0,r=INFで //l,rは探すところ P<int,V<int>> gete(int x,int y,int a,int l,int r){ if(r==INF) r=b; if(r<=x||y<=l) return {0,mu}; if(x<=l&&r<=y) return seg[a]; P<int,V<int>> a1=gete(x,y,2*a+1,l,(l+r)/2); P<int,V<int>> a2=gete(x,y,2*a+2,(l+r)/2,r); fo(i,a2.se.sz) a1.se.pb(a2.se[i]); Sort(a1.se); uni(a1.se); return {a1.se.sz,a1.se}; } };/* signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } }*/ signed main(){ int a,b,c; cin>>a>>b>>c; V<V<char>> d(a,V<char>(b)); P<int,int> e; fo(i,a){ fo(j,b){ cin>>d[i][j]; if(d[i][j]=='S') e={i,j}; } } Q<P<int,int>> f,f1; f.push({e,0}); int g=inf; fo(i,c){ f1=f; while(!f1.empty()){ P<int,int> h=f1.front(); f.push(h); f1.pop(); for(int j=-1;j<=1;j+=2){ for(int k=-1;k<=1;k+=2){ int x=f.fi+j,y=f.se+k; if(x<0||a<=x||y<0||b<=y||c[x][y]=='#') continue; f.push({x,y}); } } } } while(!f.empty()){ P<int,int> h=f.front(); g=min(g,(min(min(h.fi,a-h.fi-1),min(h.se,b-h.se-1))+c-1)/c); } cout<<g<<endl; }
a.cc: In function 'int main()': a.cc:522:9: error: no matching function for call to 'std::queue<std::pair<long long int, long long int> >::push(<brace-enclosed initializer list>)' 522 | f.push({e,0}); | ~~~~~~^~~~~~~ In file included from /usr/include/c++/14/queue:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157, from a.cc:1: /usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::deque<std::pair<long long int, long long int>, std::allocator<std::pair<long long int, long long int> > >; value_type = std::pair<long long int, long long int>]' 283 | push(const value_type& __x) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:283:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::queue<std::pair<long long int, long long int> >::value_type&' {aka 'const std::pair<long long int, long long int>&'} 283 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::deque<std::pair<long long int, long long int>, std::allocator<std::pair<long long int, long long int> > >; value_type = std::pair<long long int, long long int>]' 288 | push(value_type&& __x) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:288:25: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'} 288 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~ a.cc:8:12: error: 'class std::queue<std::pair<long long int, long long int> >' has no member named 'first' 8 | #define fi first | ^~~~~ a.cc:532:19: note: in expansion of macro 'fi' 532 | int x=f.fi+j,y=f.se+k; | ^~ a.cc:533:25: error: 'y' was not declared in this scope 533 | if(x<0||a<=x||y<0||b<=y||c[x][y]=='#') | ^ a.cc:533:37: error: invalid types 'long long int[long long int]' for array subscript 533 | if(x<0||a<=x||y<0||b<=y||c[x][y]=='#') | ^ a.cc:535:21: error: 'y' was not declared in this scope 535 | f.push({x,y}); | ^ a.cc:535:17: error: no matching function for call to 'std::queue<std::pair<long long int, long long int> >::push(<brace-enclosed initializer list>)' 535 | f.push({x,y}); | ~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::deque<std::pair<long long int, long long int>, std::allocator<std::pair<long long int, long long int> > >; value_type = std::pair<long long int, long long int>]' 283 | push(const value_type& __x) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:283:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::queue<std::pair<long long int, long long int> >::value_type&' {aka 'const std::pair<long long int, long long int>&'} 283 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::deque<std::pair<long long int, long long int>, std::allocator<std::pair<long long int, long long int> > >; value_type = std::pair<long long int, long long int>]' 288 | push(value_type&& __x) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:288:25: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'} 288 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~
s244835807
p03725
C++
/* * じょえチャンネル * 高評価・チャンネル登録よろしくおねがいします! * https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ */ // C #ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #if __cplusplus >= 201103L #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> #endif // C++ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #if __cplusplus >= 201103L #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> #endif #define f(i,n) for(int i=0;i<(n);i++) #define inf (int)(3e18) #define int long long #define mod (int)(1000000007) #define intt long long #define P pair<int,int> #define rep(i,n) for(int i=0;i<n;i++) #define REP(i,n) for(int i=1;i<=n;i++) #define ALL(v) v.begin(),v.end() using namespace std; //Library //モッドパウ int modpow(int x, int y, int m = mod) { int res = 1; while (y) { if (y % 2) { res *= x; res %= m; } x = x * x % mod; y /= 2; } return res; } int mypow(int x, int y) { int res = 1; while (y) { if (y % 2) { res *= x; } x = x * x; y /= 2; } return res; } //is the number (x) a prime number? bool prime(int x) { for (int i = 2; i * i <= x; i++) { if (!(x % i)) { return false; } } return true; } //saidai-kouyakusuu inline int gcd(int x, int y) { if (!y) { return x; } return gcd(y, x % y); } //number of keta int keta(int x) { int ans = 0; while (x) { x /= 10; ans++; } return ans; } //sum of keta int ketasum(int x) { int ans = 0; while (x) { ans += x % 10; x /= 10; } return ans; } inline int lcm(int x, int y) { int ans = x / gcd(x, y) * y; return ans; } int twobeki(int x) { int ans = 0; while (1) { if (!(x & 1)) { ans++; x /= 2; } else { break; } } return ans; } template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; } template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; } void Yes(){ cout<<"Yes"<<endl; } void No(){ cout<<"No"<<endl; } void YES(){ cout<<"YES"<<endl; } void NO(){ cout<<"NO"<<endl; } #define fin(i) scanf("%lld",&i) #define fout(i) printf("%lld",i) #define fendl printf("\n") //Library-End class modInt { int value, modulo; public: modInt() : value(0), modulo(mod) { value = 0; } template<typename T> modInt(T value = 0, int modulo = mod) : value(value), modulo(modulo) { if (value < 0) { value = -value; value %= modulo; value = -value; value += modulo; } this->value = value % modulo; } inline operator int()const { return value; } inline modInt& operator+=(modInt x) { value += x.value; if (value >= modulo)value -= modulo; return *this; } inline modInt& operator++() { if (value == modulo - 1)value = 0; else value++; return *this; } inline modInt& operator-()const { return modInt(0) -= *this; } inline modInt& operator-=(modInt x) { value -= x.value; if (value < 0)value += modulo; return *this; } inline modInt& operator--() { if (value == 0)value = modulo - 1; else value--; return *this; } inline modInt& operator*=(modInt x) { value = value * x.value % modulo; return *this; } inline modInt& operator/=(modInt x) { return operator*=(x.inv()); } inline modInt inv() { return modpow(*this, modulo - 2); } template<typename T> modInt operator+(T x) { return modInt(*this) += x; } template<typename T> modInt& operator+=(T x) { return operator+=(modInt(x, modulo)); } template<typename T> modInt operator-(T x) { return modInt(*this) -= x; } template<typename T> modInt& operator-=(T x) { return operator-=(modInt(x, modulo)); } template<typename T> modInt operator*(T x) { return modInt(*this) *= x; } template<typename T> modInt& operator*=(T x) { return operator*=(modInt(x, modulo)); } template<typename T> modInt operator/(T x) { return modInt(*this) /= x; } template<typename T> modInt& operator/=(T x) { return operator/=(modInt(x, modulo)); } }; istream& operator>>(istream& ist, modInt& x) { int a; ist >> a; x = a; return ist; } class Union_Find { vector<int> par; vector<int> rankmy; vector<int> ookisa; public: Union_Find(int size) { par = vector<int>(size); rankmy = vector<int>(size); ookisa=vector<int>(size); for (int i = 0; i < size; i++) { par[i] = i; ookisa[i]=1; } } int find(int x) { if (par[x] == x) { return x; } return par[x] = find(par[x]); } void unite(int x, int y) { x = find(x); y = find(y); if (x == y) { return; } if (rankmy[x] < rankmy[y]) { par[x] = y; ookisa[y]+=ookisa[x]; ookisa[x]=0; } else { par[y] = x; ookisa[x]+=ookisa[y]; ookisa[y]=0; if (rankmy[x] == rankmy[y]) { rankmy[x]++; } } } int size(int i){ i=find(i); return ookisa[i]; } bool same(int x, int y) { return find(x) == find(y); } }; //Union-Find-End int h,w,k,d,cnt,ans;string a[1004]; bool went[2004][2004]; void solve(int x,int y,int now){ if(a[x][y]=='#')return; if(went[x][y])continue; if(now<0)return; went[x][y]=1; if(x)solve(x-1,y,now-1); if(y)solve(x,y-1,now-1); if(x<h-1)solve(x+1,y,now-1); if(y<w-1)solve(x,y+1,now-1); } signed main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); cin>>h>>w>>k; rep(i,h){ cin>>a[i]; rep(j,w){ if(a[i][j]=='S'){ if(!i||!j||i==h-1||j==w-1){ cout<<0<<endl; return 0; } } } } rep(i,h){ rep(j,w){ if(a[i][j]=='S'){ solve(i,j,k); } } } cnt=inf; rep(i,h){ rep(j,w){ if(went[i][j]){ chmin(cnt,min({i,j,h-i-1,w-j-1})); //cout<<i<<' '<<j<<endl; } } } ans=max(0ll,(cnt+k-1)/k)+1; cout<<ans<<endl; }
a.cc: In function 'void solve(long long int, long long int, long long int)': a.cc:352:18: error: continue statement not within a loop 352 | if(went[x][y])continue; | ^~~~~~~~
s160313391
p03725
C++
/* * じょえチャンネル * 高評価・チャンネル登録よろしくおねがいします! * https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ */ // C #ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #if __cplusplus >= 201103L #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> #endif // C++ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #if __cplusplus >= 201103L #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> #endif #define f(i,n) for(int i=0;i<(n);i++) #define inf (int)(3e18) #define int long long #define mod (int)(1000000007) #define intt long long #define P pair<int,int> #define rep(i,n) for(int i=0;i<n;i++) #define REP(i,n) for(int i=1;i<=n;i++) #define ALL(v) v.begin(),v.end() using namespace std; //Library //モッドパウ int modpow(int x, int y, int m = mod) { int res = 1; while (y) { if (y % 2) { res *= x; res %= m; } x = x * x % mod; y /= 2; } return res; } int mypow(int x, int y) { int res = 1; while (y) { if (y % 2) { res *= x; } x = x * x; y /= 2; } return res; } //is the number (x) a prime number? bool prime(int x) { for (int i = 2; i * i <= x; i++) { if (!(x % i)) { return false; } } return true; } //saidai-kouyakusuu inline int gcd(int x, int y) { if (!y) { return x; } return gcd(y, x % y); } //number of keta int keta(int x) { int ans = 0; while (x) { x /= 10; ans++; } return ans; } //sum of keta int ketasum(int x) { int ans = 0; while (x) { ans += x % 10; x /= 10; } return ans; } inline int lcm(int x, int y) { int ans = x / gcd(x, y) * y; return ans; } int twobeki(int x) { int ans = 0; while (1) { if (!(x & 1)) { ans++; x /= 2; } else { break; } } return ans; } template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; } template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; } void Yes(){ cout<<"Yes"<<endl; } void No(){ cout<<"No"<<endl; } void YES(){ cout<<"YES"<<endl; } void NO(){ cout<<"NO"<<endl; } #define fin(i) scanf("%lld",&i) #define fout(i) printf("%lld",i) #define fendl printf("\n") //Library-End class modInt { int value, modulo; public: modInt() : value(0), modulo(mod) { value = 0; } template<typename T> modInt(T value = 0, int modulo = mod) : value(value), modulo(modulo) { if (value < 0) { value = -value; value %= modulo; value = -value; value += modulo; } this->value = value % modulo; } inline operator int()const { return value; } inline modInt& operator+=(modInt x) { value += x.value; if (value >= modulo)value -= modulo; return *this; } inline modInt& operator++() { if (value == modulo - 1)value = 0; else value++; return *this; } inline modInt& operator-()const { return modInt(0) -= *this; } inline modInt& operator-=(modInt x) { value -= x.value; if (value < 0)value += modulo; return *this; } inline modInt& operator--() { if (value == 0)value = modulo - 1; else value--; return *this; } inline modInt& operator*=(modInt x) { value = value * x.value % modulo; return *this; } inline modInt& operator/=(modInt x) { return operator*=(x.inv()); } inline modInt inv() { return modpow(*this, modulo - 2); } template<typename T> modInt operator+(T x) { return modInt(*this) += x; } template<typename T> modInt& operator+=(T x) { return operator+=(modInt(x, modulo)); } template<typename T> modInt operator-(T x) { return modInt(*this) -= x; } template<typename T> modInt& operator-=(T x) { return operator-=(modInt(x, modulo)); } template<typename T> modInt operator*(T x) { return modInt(*this) *= x; } template<typename T> modInt& operator*=(T x) { return operator*=(modInt(x, modulo)); } template<typename T> modInt operator/(T x) { return modInt(*this) /= x; } template<typename T> modInt& operator/=(T x) { return operator/=(modInt(x, modulo)); } }; istream& operator>>(istream& ist, modInt& x) { int a; ist >> a; x = a; return ist; } class Union_Find { vector<int> par; vector<int> rankmy; vector<int> ookisa; public: Union_Find(int size) { par = vector<int>(size); rankmy = vector<int>(size); ookisa=vector<int>(size); for (int i = 0; i < size; i++) { par[i] = i; ookisa[i]=1; } } int find(int x) { if (par[x] == x) { return x; } return par[x] = find(par[x]); } void unite(int x, int y) { x = find(x); y = find(y); if (x == y) { return; } if (rankmy[x] < rankmy[y]) { par[x] = y; ookisa[y]+=ookisa[x]; ookisa[x]=0; } else { par[y] = x; ookisa[x]+=ookisa[y]; ookisa[y]=0; if (rankmy[x] == rankmy[y]) { rankmy[x]++; } } } int size(int i){ i=find(i); return ookisa[i]; } bool same(int x, int y) { return find(x) == find(y); } }; //Union-Find-End int h,w,k,d,cnt,ans;string a[1004]; bool went[2004][2004]; void solve(int x,int y,int now){ if(a[x][y]=='#')return; if(went[i][j])continue; if(now<0)return; went[x][y]=1; if(x)solve(x-1,y,now-1); if(y)solve(x,y-1,now-1); if(x<h-1)solve(x+1,y,now-1); if(y<w-1)solve(x,y+1,now-1); } signed main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); cin>>h>>w>>k; rep(i,h){ cin>>a[i]; rep(j,w){ if(a[i][j]=='S'){ if(!i||!j||i==h-1||j==w-1){ cout<<0<<endl; return 0; } } } } rep(i,h){ rep(j,w){ if(a[i][j]=='S'){ solve(i,j,k); } } } cnt=inf; rep(i,h){ rep(j,w){ if(went[i][j]){ chmin(cnt,min({i,j,h-i-1,w-j-1})); //cout<<i<<' '<<j<<endl; } } } ans=max(0ll,(cnt+k-1)/k)+1; cout<<ans<<endl; }
a.cc: In function 'void solve(long long int, long long int, long long int)': a.cc:352:12: error: 'i' was not declared in this scope 352 | if(went[i][j])continue; | ^ a.cc:352:15: error: 'j' was not declared in this scope 352 | if(went[i][j])continue; | ^ a.cc:352:18: error: continue statement not within a loop 352 | if(went[i][j])continue; | ^~~~~~~~
s445037163
p03725
C++
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(),(x).end() using ll = long long; using ld = long double; #define vpl vector<pair<long long,long long>> #define vl vector<long long> #define vvl vector<vector<long long>> #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++) using pll = pair<long long,long long>; #define cY cout<<"Yes"<<endl #define cN cout<<"No"<<endl const long long INF = 1LL << 60; long long MOD = 1000000007; const long double pi = 3.1415926535897932; #define pb push_back #define mp make_pair #define mt make_tuple using Grid = vector<vector<char>>; #define vc vector<char> //(mod m)でのaの逆元を計算する //a/b(mod m)=a(mod m)*modinv(b,m) 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; } //最大最小の入れ替え template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } //約数列挙 vector<long long> divisor(long long n) { vector<long long> ret; for (long long i = 1; i * i <= n; i++) { if (n % i == 0) { ret.push_back(i); if (i * i != n) ret.push_back(n / i); } } sort(ret.begin(), ret.end()); // 昇順に並べる return ret; } //コンビネーション ll nCr(ll n, ll r) { ll ans = 1; for (ll i = n; i > n - r; --i) { ans = ans*i; } for (ll i = 1 ; i < r + 1; ++i) { ans = ans / i; } return ans; } //素因数分解 map< ll, ll > prime_factor(ll n) { map< ll, ll > ret; for(ll i = 2; i * i <= n; i++) { while(n % i == 0) { ret[i]++; n /= i; } } if(n != 1) ret[n] = 1; return ret; } //切り上げの割り算は(a + b - 1) / bでできる //ここから int main(){ ll H,W,K; cin>>H>>W>>K; Grid G(W,vc(H)); ll sx,sy; rep(i,H){ rep(j,W){ cin>>G[j][i]; if(G[j][i]=='S'){ sx=j; sy=i; } } } ll dist=INF; queue<pll> q; pll w=mp(sx,sy); q.push(w); visit[sx][sy]=true; map<pll,ll> D; D[w]=0; ll dx[4]={1,0,-1,0}; ll dy[4]={0,1,0,-1}; vector<vector<bool>> visit(W,vector<bool>(H,false)); while (!q.empty()) { pll P=q.front(); q.pop(); ll x=P.first; ll y=P.second; dist=min({dist,x,W-x-1,y,H-y-1}); if(D[P]==K) continue; rep(i,4){ ll nx=x+dx[i]; ll ny=y+dy[i]; if(nx<0||ny<0||ny>H-1||nx>W-1||visit[nx][ny])continue; if(G[nx][ny]=='.'){ if(nx==0||nx==W-1||ny==H-1||ny==0){ cout<<1<<endl; return 0; }else{ pll p=mp(nx,ny); q.push(p); visit[nx][ny]=true; D[p]=D[P]+1; } } } } cout<<1+(dist+K-1)/K<<endl; }
a.cc: In function 'int main()': a.cc:109:10: error: invalid types '<unresolved overloaded function type>[ll {aka long long int}]' for array subscript 109 | visit[sx][sy]=true; | ^
s025545473
p03725
C++
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(),(x).end() using ll = long long; using ld = long double; #define vpl vector<pair<long long,long long>> #define vl vector<long long> #define vvl vector<vector<long long>> #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++) using pll = pair<long long,long long>; #define cY cout<<"Yes"<<endl #define cN cout<<"No"<<endl const long long INF = 1LL << 60; long long MOD = 1000000007; const long double pi = 3.1415926535897932; #define pb push_back #define mp make_pair #define mt make_tuple using Grid = vector<vector<char>>; #define vc vector<char> //(mod m)でのaの逆元を計算する //a/b(mod m)=a(mod m)*modinv(b,m) 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; } //最大最小の入れ替え template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } //約数列挙 vector<long long> divisor(long long n) { vector<long long> ret; for (long long i = 1; i * i <= n; i++) { if (n % i == 0) { ret.push_back(i); if (i * i != n) ret.push_back(n / i); } } sort(ret.begin(), ret.end()); // 昇順に並べる return ret; } //コンビネーション ll nCr(ll n, ll r) { ll ans = 1; for (ll i = n; i > n - r; --i) { ans = ans*i; } for (ll i = 1 ; i < r + 1; ++i) { ans = ans / i; } return ans; } //素因数分解 map< ll, ll > prime_factor(ll n) { map< ll, ll > ret; for(ll i = 2; i * i <= n; i++) { while(n % i == 0) { ret[i]++; n /= i; } } if(n != 1) ret[n] = 1; return ret; } //切り上げの割り算は(a + b - 1) / bでできる //ここから int main(){ ll H,W,K; cin>>H>>W>>K; Grid G(W,vc(H)); ll sx,sy; rep(i,H){ rep(j,W){ cin>>G[j][i]; if(G[j][i]=='S'){ sx=j; sy=i; } } } ll dist=INF; queue<pll> q; pll w=mp(sx,sy); q.push(w); map<pll,ll> D; D[w]=0; ll dx[4]={1,0,-1,0}; ll dy[4]={0,1,0,-1}; vector<vector<bool>> visit(W,vector<bool>(H,false)); while (!q.empty()) { pll P=q.front(); q.pop(); ll x=P.first; ll y=P.second; if(D[P]==K+1) break; dist=min({dist,x,W-1-x,y,H-y-1}); visit[x][y]=true; rep(i,4){ ll nx=x+dx[i]; ll ny=y+dy[i]; if(nx==0||nx==W-1||ny==H-1||ny==0){ cout<<1<<endl; return 0; }else if(G[nx][ny]=='.'){ ll p=mp(nx,ny); q.push(p); D[p]=D[P]+1; } } } cout<<1+(dist+K-1)/K<<endl; }
a.cc: In function 'int main()': a.cc:130:24: error: cannot convert 'std::pair<long long int, long long int>' to 'll' {aka 'long long int'} in initialization 130 | ll p=mp(nx,ny); | ^ | | | std::pair<long long int, long long int> a.cc:131:23: error: no matching function for call to 'std::queue<std::pair<long long int, long long int> >::push(ll&)' 131 | q.push(p); | ~~~~~~^~~ In file included from /usr/include/c++/14/queue:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157, from a.cc:1: /usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::deque<std::pair<long long int, long long int>, std::allocator<std::pair<long long int, long long int> > >; value_type = std::pair<long long int, long long int>]' 283 | push(const value_type& __x) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:283:30: note: no known conversion for argument 1 from 'll' {aka 'long long int'} to 'const std::queue<std::pair<long long int, long long int> >::value_type&' {aka 'const std::pair<long long int, long long int>&'} 283 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::deque<std::pair<long long int, long long int>, std::allocator<std::pair<long long int, long long int> > >; value_type = std::pair<long long int, long long int>]' 288 | push(value_type&& __x) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:288:25: note: no known conversion for argument 1 from 'll' {aka 'long long int'} to 'std::queue<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'} 288 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~ a.cc:132:18: error: no match for 'operator[]' (operand types are 'std::map<std::pair<long long int, long long int>, long long int>' and 'll' {aka 'long long int'}) 132 | D[p]=D[P]+1; | ^ In file included from /usr/include/c++/14/map:63, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152: /usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::pair<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> >; mapped_type = long long int; key_type = std::pair<long long int, long long int>]' 504 | operator[](const key_type& __k) | ^~~~~~~~ /usr/include/c++/14/bits/stl_map.h:504:34: note: no known conversion for argument 1 from 'll' {aka 'long long int'} to 'const std::map<std::pair<long long int, long long int>, long long int>::key_type&' {aka 'const std::pair<long long int, long long int>&'} 504 | operator[](const key_type& __k) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = std::pair<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> >; mapped_type = long long int; key_type = std::pair<long long int, long long int>]' 524 | operator[](key_type&& __k) | ^~~~~~~~ /usr/include/c++/14/bits/stl_map.h:524:29: note: no known conversion for argument 1 from 'll' {aka 'long long int'} to 'std::map<std::pair<long long int, long long int>, long long int>::key_type&&' {aka 'std::pair<long long int, long long int>&&'} 524 | operator[](key_type&& __k) | ~~~~~~~~~~~^~~
s897300015
p03725
C++
//#pragma GCC optimize(3) //#pragma comment(linker,"/stack:16777216") #include<iostream> #include<cstdio> #include<string> #include<vector> #include<set> #include<map> #include<list> #include<stack> #include<queue> #include<deque> #include<functional> #include<utility> #include<algorithm> #include<sstream> #include<cstring> #include<cmath> #include<cctype> #include<exception> #include<climits> #include<cfloat> #include<iomanip> #include<bitset> #include<streambuf> #include<cstdlib> #include<ctime> //#include"functions.h" //#include"highprecision.h" #define pb push_back #define pf push_front #define ppb pop_back #define mp make_pair #define np next_permutation #define fi first #define sc second #define vi vector<int> #define vll vector<long long> #define vvi vector<vector<int> > #define vpi vector<pair<int,int> > #define pii pair<int,int> #define pll pair<long long,long long> #define pff pair<float,float> #define pdd pair<double,double> #define psi pair<string,int> #define pis pair<int,string> #define ppi pair<pii,int> #define pdi pair<pii,pii> #define LN 84757 #define INF 1e9 #define LLINF 1e18 #define MAXINT 0x7fffffff #define MAXLL 0x7fffffffffffffff #define EPS 1e-5 #define DEPS 1e-9 #define LDEPS 1e-13 #define MOD 1000000007 #define E 2.7182818284 #define PI 3.1415926535 #define rep(a,b) for(int a=0;a<b;a++) #define forn(a,n) for(int a=1;a<=n;a++) #define forr(a,n) for(int a=n;a>=0;a--) #define repn(a,n,p) for(int a=0;a<n;a+=p) #define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++) #define fillemp(a) memset(a,0,sizeof(a)) #define fillinf(a) memset(a,0x3f,sizeof(a)) #define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout); #define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout); #define inputf(a) freopen(a,"r",stdin); #define outputf(a) freopen(a,"w",stdout); #define sz(a) a.size() #define all(a) a.begin(),a.end() #define MOD 1000000007 typedef long long ll; typedef long double ld; using namespace std; int h,w,k; string s[810]; int main(){ frestream; ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>h>>w>>k; rep(i,h){ cin>>s[i]; } int sx,sy; rep(i,h)rep(j,w){ if(s[i][j]=='S'){ sx=i;sy=j; } } int to1=sx,to2=sy,to3=h-sx-1,to4=w-sy-1,mto=min(to1,min(to2,min(to3,to4))); string vv[4]; if(mto==to1){ int cx=sx,cy=sy; while(cx>=0&&cy>=0&&cx<h&&cy<w){ vv[0].pb(s[cx][cy]); cx--; } } if(mto==to2){ int cx=sx,cy=sy; while(cx>=0&&cy>=0&&cx<h&&cy<w){ vv[1].pb(s[cx][cy]); cy--; } } if(mto==to3){ int cx=sx,cy=sy; while(cx>=0&&cy>=0&&cx<h&&cy<w){ vv[2].pb(s[cx][cy]); cx++; } } if(mto==to4){ int cx=sx,cy=sy; while(cx>=0&&cy>=0&&cx<h&&cy<w){ vv[3].pb(s[cx][cy]); cy++; } } int minn=INF; string v;a rep(i,4){ int now=0; rep(j,vv[i].size()){ if(vv[i][j]=='#')now++; } if(now<minn){ minn=now; v=vv[i]; } } int ans=0; if(v[0]=='S')v[0]='.'; //cout<<v<<endl; int cur=0,cnt=0; bool st=0; while(cur!=v.size()-1){ rep(i,k){ if(cur==v.size()-1||v[cur+1]=='#')break; cur++; } for(int i=cur;i<v.size();i++){ int cc=0; if(v[i]=='#'){ v[i]='.';cc++; } if(cc==k){ break; } } ans++; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:126:18: error: 'a' was not declared in this scope 126 | string v;a | ^ a.cc:127:13: error: 'i' was not declared in this scope 127 | rep(i,4){ | ^ a.cc:60:30: note: in definition of macro 'rep' 60 | #define rep(a,b) for(int a=0;a<b;a++) | ^
s789029833
p03725
C++
#include <bits\stdc++.h> using namespace std; const int INF=0x3f3f3f3f,maxn=804; queue<int>q; int a[maxn][maxn],n,m,k,vis[maxn][maxn],sx,sy,mina; int lrud[5]={0,1,0,-1,0}; void bfs() { int i; vis[sx][sy]=0; q.push(sx);q.push(sy); while(!q.empty()) { int x=q.front();q.pop();int y=q.front();q.pop(); if(vis[x][y]==k) continue; for(i=1;i<=4;i++) { int gx=x+lrud[i-1]; int gy=y+lrud[i]; if(gx<1 || gy<1 || gx>n || gy>m || vis[x][y]+1>=vis[gx][gy] || a[gx][gy]==1) continue; vis[gx][gy]=vis[x][y]+1; q.push(gx);q.push(gy); } } } int main() { int i,j,ans=0; cin>>n>>m>>k; for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { vis[i][j]=INF; char c; cin>>c; if(c=='.') a[i][j]=0; else if(c=='#') a[i][j]=1; else { sx=i,sy=j; a[i][j]=0; } } } mina=INF; bfs(); for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { if(vis[i][j]!=INF) { mina=min(mina,min((i+k-2)/k,min((j+k-2)/k,min((n-i+k-1)/k,(m-j+k-1)/k))))+1; } } } cout<<mina; return 0; }
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory 1 | #include <bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s086583402
p03725
C++
#include <bits\stdc++.h> using namespace std; const int INF=0x3f3f3f3f,maxn=804; queue<int>q; int a[maxn][maxn],n,m,k,vis[maxn][maxn],sx,sy,mina; int lrud[5]={0,1,0,-1,0}; void bfs() { int i; vis[sx][sy]=0; q.push(sx);q.push(sy); while(!q.empty()) { int x=q.front();q.pop();int y=q.front();q.pop(); if(vis[x][y]==k) continue; for(i=1;i<=4;i++) { int gx=x+lrud[i-1]; int gy=y+lrud[i]; if(gx<1 || gy<1 || gx>n || gy>m || vis[x][y]+1>=vis[gx][gy] || a[gx][gy]==1) continue; vis[gx][gy]=vis[x][y]+1; q.push(gx);q.push(gy); } } } int main() { int i,j,ans=0; cin>>n>>m>>k; for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { vis[i][j]=INF; char c; cin>>c; if(c=='.') a[i][j]=0; else if(c=='#') a[i][j]=1; else { sx=i,sy=j; a[i][j]=0; } } } mina=INF; bfs(); for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { if(vis[i][j]!=INF) { mina=min(mina,min((i+k-2)/k,min((j+k-2)/k,min((n-i+k-1)/k,(m-j+k-1)/k))))+1; } } } cout<<mina; return 0; }
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory 1 | #include <bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s510654041
p03725
C++
//by spj_58 #include <bits/stdc++.h> using namespace std; #define REP(i,N) for(int (i)=0;i<(int)(N);i++) template <class T> bool minn(T &a,T b) { return (a > b ? (a = b, 1) : 0); } template <class T> bool maxn(T &a,T b) { return (a < b ? (a = b, 1) : 0); } const int dx[] = {0,0,-1,1}; const int dy[] = {-1,1,0,0}; int dist[801][801]; string f[801]; int nceil(int a,int b) { return (a+b-1)/b; } int main(void) { int N,M,K; cin >> N >> M >> K; int sx=-1,sy=-1; REP(i,N); { cin>>f[i]; REP(j,M) if(f[i][j]=='S') { sx=i; sy=j; } } vector<pair<int,int> > q; REP(i,N) REP(j,M) dis[i][j] = 1e9; dis[sx][sy] = 0; q.push_back(make_pair(sx,sy)); REP(cue,q.size()) { int x=q[cur].first, y=q[cur].second; int ncur=dis[x][y]; REP(d,4) { int xx = x+dx[d],yy = y+dy[d]; if(min(xx,yy) < 0 || min(N-xx,M-yy) <= 0 || dis[xx][yy] < 1e8 || f[xx][yy] == '#') continue; dis[xx][yy] = ncur+1; q.push_back(make_pair(xx,yy)); } } int ans=1e9; REP(i,N) REP(j,M) { if(dis[i][j] > K) continue; int res = 1e9; minn(res,nceil(i,K)); minn(res,nceil(j,K)); minn(res,nceil(N-i-1,K)); minn(res,nceil(M-j-1,K)); minn(ans,res+1); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:29:24: error: 'i' was not declared in this scope 29 | cin>>f[i]; | ^ a.cc:41:25: error: 'dis' was not declared in this scope; did you mean 'div'? 41 | dis[i][j] = 1e9; | ^~~ | div a.cc:42:9: error: 'dis' was not declared in this scope; did you mean 'div'? 42 | dis[sx][sy] = 0; | ^~~ | div a.cc:47:25: error: 'cur' was not declared in this scope; did you mean 'cue'? 47 | int x=q[cur].first, y=q[cur].second; | ^~~ | cue a.cc:48:33: error: 'y' was not declared in this scope 48 | int ncur=dis[x][y]; | ^
s353627487
p03725
C++
//by spj_58 #include <bits/stdc++.h> using namespace std; #define REP(i,N) for(int (i)=0;i<(int)(N);i++) template <class T> bool minn(T &a,T b) { return (a > b ? (a = b, 1) : 0); } template <class T> bool maxn(T &a,T b) { return (a < b ? (a = b, 1) : 0); } int nceil(int a,int b) { return (a+b-1)/b; } int main(void) { int N,M,K; cin >> N >> M >> K; int sx=-1,sy=-1; REP(i,N); { cin>>f[i]; REP(j,M) if(f[i][j]=='S') { sx=i; sy=j; } } vector<pair<int,int> > q; REP(i,N) REP(j,M) dis[i][j] = 1e9; dis[sx][sy] = 0; q.push_back(make_pair(sx,sy)); REP(cue,q.size()) { int x=q[cur].first, y=q[cur].second; int ncur=dis[x][y]; REP(d,4) { int xx = x+dx[d],yy = y+dy[d]; if(min(xx,yy) < 0 || min(N-xx,M-yy) <= 0 || dis[xx][yy] < 1e8 || f[xx][yy] == '#') continue; dis[xx][yy] = ncur+1; q.push_back(make_pair(xx,yy)); } } int ans=1e9; REP(i,N) REP(j,M) { if(dis[i][j] > K) continue; int res = 1e9; minn(res,nceil(i,K)); minn(res,nceil(j,K)); minn(res,nceil(N-i-1,K)); minn(res,nceil(M-j-1,K)); minn(ans,res+1); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:23:22: error: 'f' was not declared in this scope 23 | cin>>f[i]; | ^ a.cc:23:24: error: 'i' was not declared in this scope 23 | cin>>f[i]; | ^ a.cc:35:25: error: 'dis' was not declared in this scope; did you mean 'div'? 35 | dis[i][j] = 1e9; | ^~~ | div a.cc:36:9: error: 'dis' was not declared in this scope; did you mean 'div'? 36 | dis[sx][sy] = 0; | ^~~ | div a.cc:41:25: error: 'cur' was not declared in this scope; did you mean 'cue'? 41 | int x=q[cur].first, y=q[cur].second; | ^~~ | cue a.cc:42:33: error: 'y' was not declared in this scope 42 | int ncur=dis[x][y]; | ^ a.cc:46:36: error: 'dx' was not declared in this scope; did you mean 'xx'? 46 | int xx = x+dx[d],yy = y+dy[d]; | ^~ | xx a.cc:47:35: error: 'yy' was not declared in this scope; did you mean 'sy'? 47 | if(min(xx,yy) < 0 || min(N-xx,M-yy) <= 0 || dis[xx][yy] < 1e8 || f[xx][yy] == '#') continue; | ^~ | sy a.cc:47:90: error: 'f' was not declared in this scope 47 | if(min(xx,yy) < 0 || min(N-xx,M-yy) <= 0 || dis[xx][yy] < 1e8 || f[xx][yy] == '#') continue; | ^ a.cc:48:33: error: 'yy' was not declared in this scope; did you mean 'sy'? 48 | dis[xx][yy] = ncur+1; | ^~ | sy
s803616390
p03725
C++
//by spj_58 #include <bits/stdc++.h> using namespace std; #define REP(i,N) for(int (i)=0;i<(int)(N);i++) template <class T> bool minn(T &a,T b) { return (a > b ? (a = b, 1) : 0); } template <class T> bool maxn(T &a,T b) { return (a < b ? (a = b, 1) : 0); } int nceil(int a,int b) { return (a+b-1)/b; } int main(void) { int N,M,K; cin >> N >> M >> K; int sx=-1,sy=-1; REP(i,N); { cin>>f[i]; REP(j,M) if(f[i][j]=='S') { sx=i; sy=j; } } vector<pair<int,int> > q; REP(i,N) REP(j,M) dis[i][j] = 1e9; dis[sx][sy] = 0; q.push_back(make_pair(sx,sy)); REP(cue,q.size()) { int x=q[cur].first, y=q[cur].second; int ncur=dis[x][y]; REP(d,4) { int xx = x+dx[d],yy = y+dy[d]; if(min(xx,yy) < 0 || min(N-xx,M-yy) <= 0 || dis[xx][yy] < 1e8 || f[xx][yy] == '#') continue; dis[xx][yy] = ncur+1; q.push_back(make_pair(xx,yy)); } } int ans=1e9; REP(i,N) REP(j,M) { if(dis[i][j] > K) continue; int res = 1e9; minn(res,nceil(i,K)); minn(res,nceil(j,K)); minn(res,nceil(N-i-1,K)); minn(res,nceil(M-j-1,K)); minn(ans,res+1); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:23:22: error: 'f' was not declared in this scope 23 | cin>>f[i]; | ^ a.cc:23:24: error: 'i' was not declared in this scope 23 | cin>>f[i]; | ^ a.cc:35:25: error: 'dis' was not declared in this scope; did you mean 'div'? 35 | dis[i][j] = 1e9; | ^~~ | div a.cc:36:9: error: 'dis' was not declared in this scope; did you mean 'div'? 36 | dis[sx][sy] = 0; | ^~~ | div a.cc:41:25: error: 'cur' was not declared in this scope; did you mean 'cue'? 41 | int x=q[cur].first, y=q[cur].second; | ^~~ | cue a.cc:42:33: error: 'y' was not declared in this scope 42 | int ncur=dis[x][y]; | ^ a.cc:46:36: error: 'dx' was not declared in this scope; did you mean 'xx'? 46 | int xx = x+dx[d],yy = y+dy[d]; | ^~ | xx a.cc:47:35: error: 'yy' was not declared in this scope; did you mean 'sy'? 47 | if(min(xx,yy) < 0 || min(N-xx,M-yy) <= 0 || dis[xx][yy] < 1e8 || f[xx][yy] == '#') continue; | ^~ | sy a.cc:47:90: error: 'f' was not declared in this scope 47 | if(min(xx,yy) < 0 || min(N-xx,M-yy) <= 0 || dis[xx][yy] < 1e8 || f[xx][yy] == '#') continue; | ^ a.cc:48:33: error: 'yy' was not declared in this scope; did you mean 'sy'? 48 | dis[xx][yy] = ncur+1; | ^~ | sy
s693210129
p03725
C++
#include<bits/stdc++.h> using namespace std; char c[107][107]; int n,m,k,pi,pj,a[107][107],mn=10000; bool vis[107][107]; int uint(int a,int b){ if(a%b!=0)return a/b+1;else return a/b; } void dfs(int p,int i,int j){ if(c[i][j]=='#')return; if(p==0)return; if(vis[i][j])return; else vis[i][j]=1; mn=min(mn,uint(a[i][j],k)); dfs(p-1,i+1,j); dfs(p-1,i,j+1); dfs(p-1,i-1,j); dfs(p-1,i,j-1); } int main(){ cin>>n>>m>>k; for(int i=1;i<=n;i++){ scanf("%s",c[i]); for(int j=0;j<m;j++){ if(c[i][j]=='S'){ pi=i; pj=j; } a[i][j]=min(i-1,j-0); } } memset(vis,0,sizeof(vis)); dfs(k,pi,pj); cout<<mn+1; return 0; }
a.cc:6:21: error: 'int uint(int, int)' redeclared as different kind of entity 6 | int uint(int a,int b){ | ^ In file included from /usr/include/stdlib.h:514, from /usr/include/c++/14/cstdlib:79, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42, from a.cc:1: /usr/include/x86_64-linux-gnu/sys/types.h:150:22: note: previous declaration 'typedef unsigned int uint' 150 | typedef unsigned int uint; | ^~~~ a.cc: In function 'void dfs(int, int, int)': a.cc:14:33: error: expression list treated as compound expression in functional cast [-fpermissive] 14 | mn=min(mn,uint(a[i][j],k)); | ^ a.cc:14:15: error: no matching function for call to 'min(int&, uint)' 14 | mn=min(mn,uint(a[i][j],k)); | ~~~^~~~~~~~~~~~~~~~~~~~ In file included 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_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:14:15: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'uint' {aka 'unsigned int'}) 14 | mn=min(mn,uint(a[i][j],k)); | ~~~^~~~~~~~~~~~~~~~~~~~ /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:14:15: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 14 | mn=min(mn,uint(a[i][j],k)); | ~~~^~~~~~~~~~~~~~~~~~~~
s319417967
p03725
C++
#include<bits/stdc++.h> using namespace std; char c[107][107]; int n,m,k,pi,pj,a[107][107],mn=10000; bool vis[107][107]; int uint(int a,int b){ if(a%b!=0)return a/b+1;else return a/b; } void dfs(int p,int i,int j){ if(c[i][j]=='#')return; if(p==0)return; if(vis[i][j])return; else vis[i][j]=1; mn=min(mn,uint(a[i][j],k)); dfs(p-1,i+1,j); dfs(p-1,i,j+1); dfs(p-1,i-1,j); dfs(p-1,i,j-1); } int main(){ cin>>n>>m>>k; for(int i=1;i<=n;i++){ scanf("%s",c[i]); for(int j=0;j<m;j++){ if(c[i][j]=='S'){ pi=i; pj=j; } a[i][j]=min(i-1,j-0); } } memset(vis,0,sizeof(vis)); dfs(k,pi,pj); cout<<mn+1; return 0; }
a.cc:6:21: error: 'int uint(int, int)' redeclared as different kind of entity 6 | int uint(int a,int b){ | ^ In file included from /usr/include/stdlib.h:514, from /usr/include/c++/14/cstdlib:79, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42, from a.cc:1: /usr/include/x86_64-linux-gnu/sys/types.h:150:22: note: previous declaration 'typedef unsigned int uint' 150 | typedef unsigned int uint; | ^~~~ a.cc: In function 'void dfs(int, int, int)': a.cc:14:33: error: expression list treated as compound expression in functional cast [-fpermissive] 14 | mn=min(mn,uint(a[i][j],k)); | ^ a.cc:14:15: error: no matching function for call to 'min(int&, uint)' 14 | mn=min(mn,uint(a[i][j],k)); | ~~~^~~~~~~~~~~~~~~~~~~~ In file included 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_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:14:15: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'uint' {aka 'unsigned int'}) 14 | mn=min(mn,uint(a[i][j],k)); | ~~~^~~~~~~~~~~~~~~~~~~~ /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:14:15: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 14 | mn=min(mn,uint(a[i][j],k)); | ~~~^~~~~~~~~~~~~~~~~~~~
s146351390
p03725
C++
#include<bits/stdc++.h> using namespace std; char c[107][107]; int n,m,k,pi,pj,a[107][107],mn=10000; bool vis[107][107]; int uint(int a,int b){ if(a%b!=0)return a/b+1;else return a/b; } void dfs(int p,int i,int j){ if(c[i][j]=='#')return; if(p==0)return; if(vis[i][j])return; else vis[i][j]=1; mn=min(mn,uint(a[i][j],k)); dfs(p-1,i+1,j); dfs(p-1,i,j+1); dfs(p-1,i-1,j); dfs(p-1,i,j-1); } int main(){ cin>>n>>m>>k; for(int i=1;i<=n;i++){ scanf("%s",c[i]); for(int j=0;j<m;j++){ if(c[i][j]=='S'){ pi=i; pj=j; } a[i][j]=min(i-1,j-0); } } memset(vis,0,sizeof(vis)); dfs(k,pi,pj); cout<<mn+1; return 0; }
a.cc:6:21: error: 'int uint(int, int)' redeclared as different kind of entity 6 | int uint(int a,int b){ | ^ In file included from /usr/include/stdlib.h:514, from /usr/include/c++/14/cstdlib:79, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42, from a.cc:1: /usr/include/x86_64-linux-gnu/sys/types.h:150:22: note: previous declaration 'typedef unsigned int uint' 150 | typedef unsigned int uint; | ^~~~ a.cc: In function 'void dfs(int, int, int)': a.cc:14:33: error: expression list treated as compound expression in functional cast [-fpermissive] 14 | mn=min(mn,uint(a[i][j],k)); | ^ a.cc:14:15: error: no matching function for call to 'min(int&, uint)' 14 | mn=min(mn,uint(a[i][j],k)); | ~~~^~~~~~~~~~~~~~~~~~~~ In file included 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_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:14:15: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'uint' {aka 'unsigned int'}) 14 | mn=min(mn,uint(a[i][j],k)); | ~~~^~~~~~~~~~~~~~~~~~~~ /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:14:15: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 14 | mn=min(mn,uint(a[i][j],k)); | ~~~^~~~~~~~~~~~~~~~~~~~
s622235047
p03725
C++
#include <bits/stdc++.h> // #include <iostream> // cout, endl, cin // #include <string> // string, to_string, stoi // #include <vector> // vector // #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound // #include <utility> // pair, make_pair // #include <tuple> // tuple, make_tuple // #include <cstdint> // int64_t, int*_t // #include <cstdio> // printf // #include <map> // map // #include <queue> // queue, priority_queue // #include <set> // set // #include <stack> // stack // #include <deque> // deque // #include <unordered_map> // unordered_map // #include <unordered_set> // unordered_set // #include <bitset> // bitset // #include <climits> // #include <cmath> // #include <iomanip> // #include <functional> // #include <numeric> // #include <random> using namespace std; #define int long long #define pb push_back #define F first #define S second #define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++) #define rep(i,n) FOR(i,0,n) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() #define ve vector #define vi vector<int> #define vp vector<pair<int,int>> #define vvi vector<vector<int>> #define pint pair<int, int> template<typename T> using pq = priority_queue<T,vector<T>,greater<T>>; using ll = long long; ll INF = LLONG_MAX / 4000 - 100; ll mod = 1e9 + 7; int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1}; vector<ll> prime; class fact { public: int fmod = 1e9+7; vector<int> fac, inv; fact (int n, int Mod = 1e9+7) { fmod = Mod; fac = vector<int>(n,0); inv = vector<int>(n,0); fac[0] = 1; for (int i = 1; i < n; i++) fac[i] = fac[i-1] * i % fmod; for (int i = 0;i < n;i++) inv[i] = fact::POW(fac[i],fmod-2); } ll nCr(ll n, ll r) {if(n < r) return 0; return (fac[n] * inv[r] % fmod) * inv[n-r] % fmod;} ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%fmod;}a = a * a%fmod; b >>= 1;}return c;} inline int operator [] (int i) {return fac[i];} }; template <class T = ll> T in() {T x; cin >> x; return (x);} void DEBUG(vector<int> a) {for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;} void EMP(int x) {cout<<"!!!"<<x<<"!!!"<<endl;} ll GCD(ll a, ll b) {ll c; while (b != 0) {c = a % b; a = b; b = c;}return a;} ll LCM(ll a, ll b) {return (a / GCD(a, b)) * (b / GCD(a, b)) * GCD(a, b);} ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%mod;}a = a * a%mod; b >>= 1;}return c;} void PRI(ll n) {bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) {a[i] = 1LL;}for (int i = 2; i < n + 1LL; i++) {if (a[i]) {prime.pb(i); ll b = i; while (b <= n) {a[b] = 0; b += i;}}}} template <typename T> T chmin(T& a, T b) {if(a>b)a=b;return a;} template <typename T> T chmax(T& a, T b) {if(a<b)a=b;return b;} bool isSqrt(ll a) {return pow(sqrt(a),2) == a ? 1 : 0;} void YesNo(bool a) {if (a) cout << "Yes"; else cout << "No"; cout << endl;} void yesno(bool a) {if (a) cout << "yes"; else cout << "no"; cout << endl;} void YESNO(bool a) {if (a) cout << "YES"; else cout << "NO"; cout << endl;} double dis(int x1, int x2, int y1, int y2) { return sqrt((double)abs(x1-x2)*(double)abs(x1-x2)+(double)abs(y1-y2)*(double)abs(y1-y2)); } int ceili(int x, int y) { return x / y + (x % y!=0)} bool solve() { int h, w, k; cin >> h >> w >> k; string bd[h]; rep (i, h) cin >> bd[i]; int sx = 0, sy = 0; rep (i, h) { rep (j, w) { if (bd[i][j] == 'S') sx = i, sy = j; } } queue<int> X, Y; X.push(sx), Y.push(sy); vector<vector<int>> cst(h, vector<int>(w, INF)); cst[sx][sy] = 0; while (X.size()) { int x = X.front(), y = Y.front(); X.pop(), Y.pop(); rep (i, 4) { int nx = x + dx[i], ny = y + dy[i]; if (nx<0||h<=nx||0<ny||w<=ny) continue; if (bd[nx][ny] == '#') continue; if (cst[nx][ny] > cst[x][y] + 1) { cst[nx][ny] = cst[x][y] + 1; X.push(nx), Y.push(ny); } } } int ans = INF; rep (i, h) { rep (j, w) { if (cst[i][j] > k) continue; int add = min({i, h-i-1, j, w-j-1}); chmin(ans, 1 + ceili(add, k)); } } cout << ans << endl; } signed main() { cin.tie(0); ios::sync_with_stdio(false); solve(); }
a.cc: In function 'long long int ceili(long long int, long long int)': a.cc:82:28: error: expected ';' before '}' token 82 | return x / y + (x % y!=0)} | ^ | ; a.cc: In function 'bool solve()': a.cc:118:1: warning: no return statement in function returning non-void [-Wreturn-type] 118 | } | ^
s541136908
p03725
C++
#include <bits/stdc++.h> // #include <iostream> // cout, endl, cin // #include <string> // string, to_string, stoi // #include <vector> // vector // #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound // #include <utility> // pair, make_pair // #include <tuple> // tuple, make_tuple // #include <cstdint> // int64_t, int*_t // #include <cstdio> // printf // #include <map> // map // #include <queue> // queue, priority_queue // #include <set> // set // #include <stack> // stack // #include <deque> // deque // #include <unordered_map> // unordered_map // #include <unordered_set> // unordered_set // #include <bitset> // bitset // #include <climits> // #include <cmath> // #include <iomanip> // #include <functional> // #include <numeric> // #include <random> using namespace std; #define int long long #define pb push_back #define F first #define S second #define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++) #define rep(i,n) FOR(i,0,n) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() #define ve vector #define vi vector<int> #define vp vector<pair<int,int>> #define vvi vector<vector<int>> #define pint pair<int, int> template<typename T> using pq = priority_queue<T,vector<T>,greater<T>>; using ll = long long; ll INF = LLONG_MAX / 4000 - 100; ll mod = 1e9 + 7; int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1}; vector<ll> prime; class fact { public: int fmod = 1e9+7; vector<int> fac, inv; fact (int n, int Mod = 1e9+7) { fmod = Mod; fac = vector<int>(n,0); inv = vector<int>(n,0); fac[0] = 1; for (int i = 1; i < n; i++) fac[i] = fac[i-1] * i % fmod; for (int i = 0;i < n;i++) inv[i] = fact::POW(fac[i],fmod-2); } ll nCr(ll n, ll r) {if(n < r) return 0; return (fac[n] * inv[r] % fmod) * inv[n-r] % fmod;} ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%fmod;}a = a * a%fmod; b >>= 1;}return c;} inline int operator [] (int i) {return fac[i];} }; template <class T = ll> T in() {T x; cin >> x; return (x);} void DEBUG(vector<int> a) {for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;} void EMP(int x) {cout<<"!!!"<<x<<"!!!"<<endl;} ll GCD(ll a, ll b) {ll c; while (b != 0) {c = a % b; a = b; b = c;}return a;} ll LCM(ll a, ll b) {return (a / GCD(a, b)) * (b / GCD(a, b)) * GCD(a, b);} ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%mod;}a = a * a%mod; b >>= 1;}return c;} void PRI(ll n) {bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) {a[i] = 1LL;}for (int i = 2; i < n + 1LL; i++) {if (a[i]) {prime.pb(i); ll b = i; while (b <= n) {a[b] = 0; b += i;}}}} template <typename T> T chmin(T& a, T b) {if(a>b)a=b;return a;} template <typename T> T chmax(T& a, T b) {if(a<b)a=b;return b;} bool isSqrt(ll a) {return pow(sqrt(a),2) == a ? 1 : 0;} void YesNo(bool a) {if (a) cout << "Yes"; else cout << "No"; cout << endl;} void yesno(bool a) {if (a) cout << "yes"; else cout << "no"; cout << endl;} void YESNO(bool a) {if (a) cout << "YES"; else cout << "NO"; cout << endl;} double dis(int x1, int x2, int y1, int y2) { return sqrt((double)abs(x1-x2)*(double)abs(x1-x2)+(double)abs(y1-y2)*(double)abs(y1-y2)); } bool solve() { int h, w, k; cin >> h >> w >> k; string bd[h]; rep (i, h) cin >> bd[i]; int sx = 0, sy = 0; rep (i, h) { rep (j, w) { if (bd[i][j] == 'S') sx = i, sy = j; } } queue<int> X, Y; X.push(sx), Y.push(sy); vector<vector<int>> cst(h, vector<int>(w, INF)); cst[sx][sy] = 0; while (X.size()) { int x = X.front(), y = Y.front(); X.pop(), Y.pop(); rep (i, 4) { int nx = x + dx[i], ny = y + dy[i]; if (nx<0||h<=nx||0<ny||w<=ny) continue; if (bd[nx][ny] == '#') continue; if (cst[nx][ny] > cst[x][y] + 1) { cst[nx][ny] = cst[x][y] + 1; X.push(nx), Y.push(ny); } } } int ans = INF; rep (i, h) { rep (j, w) { if (cst[i][j] > k) continue; int add = min({i, h-i-1, j, w-j-1}); chmin(ans, 1 + ceili(add, k)); } } cout << ans << endl; } signed main() { cin.tie(0); ios::sync_with_stdio(false); solve(); }
a.cc: In function 'bool solve()': a.cc:112:28: error: 'ceili' was not declared in this scope; did you mean 'ceill'? 112 | chmin(ans, 1 + ceili(add, k)); | ^~~~~ | ceill a.cc:116:1: warning: no return statement in function returning non-void [-Wreturn-type] 116 | } | ^
s121624284
p03725
C++
#include <bits/stdc++.h> // #include <iostream> // cout, endl, cin // #include <string> // string, to_string, stoi // #include <vector> // vector // #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound // #include <utility> // pair, make_pair // #include <tuple> // tuple, make_tuple // #include <cstdint> // int64_t, int*_t // #include <cstdio> // printf // #include <map> // map // #include <queue> // queue, priority_queue // #include <set> // set // #include <stack> // stack // #include <deque> // deque // #include <unordered_map> // unordered_map // #include <unordered_set> // unordered_set // #include <bitset> // bitset // #include <climits> // #include <cmath> // #include <iomanip> // #include <functional> // #include <numeric> // #include <random> using namespace std; #define int long long #define pb push_back #define F first #define S second #define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++) #define rep(i,n) FOR(i,0,n) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() #define ve vector #define vi vector<int> #define vp vector<pair<int,int>> #define vvi vector<vector<int>> #define pint pair<int, int> template<typename T> using pq = priority_queue<T,vector<T>,greater<T>>; using ll = long long; ll INF = LLONG_MAX / 4000 - 100; ll mod = 1e9 + 7; int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1}; vector<ll> prime; class fact { public: int fmod = 1e9+7; vector<int> fac, inv; fact (int n, int Mod = 1e9+7) { fmod = Mod; fac = vector<int>(n,0); inv = vector<int>(n,0); fac[0] = 1; for (int i = 1; i < n; i++) fac[i] = fac[i-1] * i % fmod; for (int i = 0;i < n;i++) inv[i] = fact::POW(fac[i],fmod-2); } ll nCr(ll n, ll r) {if(n < r) return 0; return (fac[n] * inv[r] % fmod) * inv[n-r] % fmod;} ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%fmod;}a = a * a%fmod; b >>= 1;}return c;} inline int operator [] (int i) {return fac[i];} }; template <class T = ll> T in() {T x; cin >> x; return (x);} void DEBUG(vector<int> a) {for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;} void EMP(int x) {cout<<"!!!"<<x<<"!!!"<<endl;} ll GCD(ll a, ll b) {ll c; while (b != 0) {c = a % b; a = b; b = c;}return a;} ll LCM(ll a, ll b) {return (a / GCD(a, b)) * (b / GCD(a, b)) * GCD(a, b);} ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%mod;}a = a * a%mod; b >>= 1;}return c;} void PRI(ll n) {bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) {a[i] = 1LL;}for (int i = 2; i < n + 1LL; i++) {if (a[i]) {prime.pb(i); ll b = i; while (b <= n) {a[b] = 0; b += i;}}}} template <typename T> T chmin(T& a, T b) {if(a>b)a=b;return a;} template <typename T> T chmax(T& a, T b) {if(a<b)a=b;return b;} bool isSqrt(ll a) {return pow(sqrt(a),2) == a ? 1 : 0;} void YesNo(bool a) {if (a) cout << "Yes"; else cout << "No"; cout << endl;} void yesno(bool a) {if (a) cout << "yes"; else cout << "no"; cout << endl;} void YESNO(bool a) {if (a) cout << "YES"; else cout << "NO"; cout << endl;} double dis(int x1, int x2, int y1, int y2) { return sqrt((double)abs(x1-x2)*(double)abs(x1-x2)+(double)abs(y1-y2)*(double)abs(y1-y2)); } bool solve() { int h, w, k; cin >> h >> w >> k; string bd[h]; rep (i, h) cin >> bd[i]; int sx = 0, sy = 0; rep (i, h) { rep (j, w) { if (bd[i][j] == 'S') sx = i, sy = j; } } queue<int> X, Y; X.push(sx), Y.push(sy); vector<vector<int>> cst(h, vector(w, INF)); cst[sx][sy] = 0; while (X.size()) { int x = X.front(); y = Y.front(); X.pop(), Y.pop(); rep (i, 4) { int nx = x + dx[i], ny = y + dy[i]; if (cst[nx][ny] > cst[x][y] + 1) { cst[nx][ny] = cst[x][y] + 1; X.push(nx), Y.push(ny); } } } int ans = INF; rep (i, h) { rep (j, w) { if (cst[i][j] > k) continue; int add = min({i, h-i-1, j, w-j-1}); chmin(ans, (cst[i][j] + add - 1) / k + 1); } } cout << ans << endl; } signed main() { cin.tie(0); ios::sync_with_stdio(false); solve(); }
a.cc: In function 'bool solve()': a.cc:96:28: error: 'y' was not declared in this scope 96 | int x = X.front(); y = Y.front(); X.pop(), Y.pop(); | ^ a.cc:114:1: warning: no return statement in function returning non-void [-Wreturn-type] 114 | } | ^
s986140474
p03725
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> Pii; typedef pair<ll,ll> Pll; #define rep(i,n) for (ll i=0;i<n;++i) #define rep2(i,a,b) for (ll i=a;i<b;++i) const ll MOD=1e9+7; const ll INF=1e9; const ll IINF=1e18; const double EPS=1e-8; const double pi=acos(-1); template<class T> inline bool chmin(T &a,T b){ if (a>b){ a=b; return true; } return false; } template<class T> inline bool chmax(T &a,T b){ if (a<b){ a=b; return true; } return false; } int main(){ int H,W,K; cin >> H >> W >> K; vector<string> A(H); rep(i,H) cin >> A[i]; int sh,sw; rep(i,H) rep(j,W) if (A[i][j]=='S') sh=i,sw=j; int dh[4]={1,0,-1,0}; int dw[4]={0,1,0,-1}; queue<Pii> que; que.push(Pii(sh,sw)); vector<vector<int>> d(H,vector<int>(W,-1)); d[sh][sw]=0; int ans=INF; while(!que.empty()){ Pii p=que.front(); que.pop(); int h=p.first,w=p.second; int x=(d[h][w]+min(h,min(H-1-h,min(w,W-1-w)))+K-1)/K; if (d[h][w]<K) x=1+(min(h,min(H-1-h,min(w,W-1-w)))+K-1)/K; chmin(ans,x); rep(j,4){ int nh=h+dh[j],nw=w+dw[j]; if (nh<0||nh>=H||nw<0||nw>=W) continue; if (A[nh][nw]=='#') continue; if (d[nh][nw]!=-1) continue; d[nh][nw]=d[h][w]+1; que.push(Pii(nh,nw)); } } cout << ans << endl; }
a.cc:52:28: error: stray '\16' in program 52 | if (nh<0||nh>=H<U+000E>||nw<0||nw>=W) continue; | ^~~~~~~~
s074601819
p03725
C++
#include<bits/stdc++.h> using namespace std; #define ll long long #define FOR(a,b) for(int i=a;i<=b;i++) #define FORBACK(a,b) for(int i=b;i>=a;i--) #define pb push_back #define mp make_pair #define sz size #define fi first #define se second typedef pair <int , int> ii; int r,c,k,ans; char arr[805][805]; vector<pair<int,int> >v; bool visited[805][805]; struct State { int b, k, byk; State(){} State(int _b, int _k, int z){ b = _b; k = _k; byk = z; } }; State s; queue<State> q; int dx[]={-1,0,1,0}; int dy[]={0,-1,0,1}; bool inside(int ro,int co){ return 1<=ro && ro <=r && 1<=co && co<=c; } void bfs(int sr, int sc,int Byk){ q.push(State(sr,sc,Byk)); while(!q.empty()){ State now = q.front(); q.pop(); int cb = now.b; int ck = now.k; int cbyk = now.byk; //cout << " :: " << b << " " << k << " " << byk << endl; if(cbyk<=ck){ v.pb(mp(cb,ck)); } for(int i=0;i<4;i++){ if(inside(cb + dx[i],ck + dy[i]) && arr[cb + dx[i]][ck + dy[i]]!='#' && visited[cb + dx[i]][ck + dy[i]]==false){ visited[cb + dx[i]][ck + dy[i]]=true; q.push(State(cb + dx[i], ck + dy[i], cbyk + 1)); } } } } int min3(int a , int b , int c) { return min(min(a , b) , c); } int min4(int a , int b , int c , int d) { return min(min3(a , b , c) , d); } int updiv(int a , int b) { int tmp = a / b; return tmp * b < a ? tmp + 1 : tmp; } int main(){ // ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); cin>>r>>c>>k; for(int i=1;i<=r;i++){ for(int j=1;j<=c;j++){ cin>>arr[i][j]; } } for(int i=1;i<=r;i++){ for(int j=1;j<=c;j++){ if(arr[i][j]=='S'){ bfs(i,j,0); break; } } } int sol = INT_MAX; int _r = vec.fi, _c = vec.se; sol = min(sol , min4(_c - 1 , c - _c , _r - 1 , r - _r)); } printf("%d\n" , updiv(sol , k) + 1); }
a.cc: In function 'int main()': a.cc:84:26: error: 'vec' was not declared in this scope 84 | int _r = vec.fi, _c = vec.se; | ^~~ a.cc:85:38: error: '_c' was not declared in this scope; did you mean '_r'? 85 | sol = min(sol , min4(_c - 1 , c - _c , _r - 1 , r - _r)); | ^~ | _r a.cc: At global scope: a.cc:87:15: error: expected constructor, destructor, or type conversion before '(' token 87 | printf("%d\n" , updiv(sol , k) + 1); | ^ a.cc:88:1: error: expected declaration before '}' token 88 | } | ^
s740192127
p03725
C++
#include<bits/stdc++.h> using namespace std; #define ll long long #define FOR(a,b) for(int i=a;i<=b;i++) #define FORBACK(a,b) for(int i=b;i>=a;i--) #define pb push_back #define mp make_pair #define sz size #define fi first #define se second typedef pair <int , int> ii; int r,c,k,ans; char arr[805][805]; vector<pair<int,int> >v; bool visited[805][805]; struct State { int b, k, byk; State(){} State(int _b, int _k, int z){ b = _b; k = _k; byk = z; } }; State s; queue<State> q; int dx[]={-1,0,1,0}; int dy[]={0,-1,0,1}; bool inside(int ro,int co){ return 1<=ro && ro <=r && 1<=co && co<=c; } void bfs(int sr, int sc,int Byk){ q.push(State(sr,sc,Byk)); while(!q.empty()){ State now = q.front(); q.pop(); int cb = now.b; int ck = now.k; int cbyk = now.byk; //cout << " :: " << b << " " << k << " " << byk << endl; if(cbyk<=ck){ v.pb(mp(cb,ck)); } for(int i=0;i<4;i++){ if(inside(cb + dx[i],ck + dy[i]) && arr[cb + dx[i]][ck + dy[i]]!='#' && visited[cb + dx[i]][ck + dy[i]]==false){ visited[cb + dx[i]][ck + dy[i]]=true; q.push(State(cb + dx[i], ck + dy[i], cbyk + 1)); } } } } int min3(int a , int b , int c) { return min(min(a , b) , c); } int min4(int a , int b , int c , int d) { return min(min3(a , b , c) , d); } int updiv(int a , int b) { int tmp = a / b; return tmp * b < a ? tmp + 1 : tmp; } int main(){ // ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); cin>>r>>c>>k; for(int i=1;i<=r;i++){ for(int j=1;j<=c;j++){ cin>>arr[i][j]; } } for(int i=1;i<=r;i++){ for(int j=1;j<=c;j++){ if(arr[i][j]=='S'){ bfs(i,j,0); break; } } } int sol = INT_MAX; for (ii vec : v) { int _r = vec.fi, _c = vec.se; sol = min(sol , min4(_c - 1 , c - _c , _r - 1 , r - _r)); } printf("%d\n" , updiv(sol , k) + 1); } e
a.cc:90:1: error: 'e' does not name a type; did you mean 'se'? 90 | e | ^ | se
s986039566
p03725
C++
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<n;i++) #define REPP(i,n) for(int i=1;i<=n;i++) const double PI = acos(-1); const double EPS = 1e-15; long long INF=(long long)1E17; #define i_7 (long long)(1E9+7) long mod(long a){ long long c=a%i_7; if(c>=0)return c; return c+i_7; } using namespace std; bool prime(int n){ if(n==1){ return false; }else if(n==2){ return true; }else{ for(int i=2;i<=sqrt(n);i++){ if(n%i==0){ return false; } } return true; } } long long gcd(long long a, long long b){ if(a<b){ swap(a,b); } if(a%b==0){ return b; }else{ return gcd(b,a%b); } } long long lcm(long long x, long long y){ return (x/gcd(x,y))*y; } class UnionFind { public: //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。 vector<int> Parent; //クラスを作るときは、Parentの値を全て-1にする。 //以下のようにすると全てバラバラの頂点として解釈できる。 UnionFind(int N) { Parent = vector<int>(N, -1); } //Aがどのグループに属しているか調べる int root(int A) { if (Parent[A] < 0) return A; return Parent[A] = root(Parent[A]); } //自分のいるグループの頂点数を調べる int size(int A) { return -Parent[root(A)];//先祖をrootで取っておきたい。 } //AとBをくっ付ける bool connect(int A, int B) { //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける A = root(A); B = root(B); if (A == B) { //すでにくっついてるからくっ付けない return false; } //大きい方(A)に小さいほう(B)をくっ付けたい //大小が逆だったらAとBをひっくり返す。 if (size(A) < size(B)) swap(A, B); //Aのサイズを更新する Parent[A] += Parent[B]; //Bの親をAに変更する Parent[B] = A; return true; } }; int main(){ int h,w,k; cin>>h>>w>>k; vector<string> a(h); REP(i,h){ cin>>a[i]; } vector<vector<int>> d(h,vector<int>(w,-1)); queue<pair<int,int>> q; REP(i,h){ REP(j,w){ if(a[i][j]=='S'){ d[i][j]=0; q.push_back(make_pair(i,j)); } } } pair<int,int> p; int x,y; int nx,ny; int dx[]={1,0,-1,0}; int dy[]={0,1,0,-1}; while(!q.empty()){ p = q.front(); x = p.first;y = p.second; q.pop(); if(d[x][y]==k)continue; REP(i,4){ nx = x + dx[i];ny = y+dy[i]; if(0<=nx && nx<h && 0<=ny && ny<w && a[nx][ny] == '.'){ d[nx][ny] = d[x][y]+1; q.push(make_pair(nx,ny)); } } } int ans = 1000; int temp; REP(i,h){ REP(j,w){ if(d[i][j]<0)continue; temp = (i+k-1)/k; temp = min(temp,(j+k-1)/k); temp = min(temp,(h-1-i+k-1)/k); temp = min(temp,(w-1-j+k-1)/k); ans = min(ans,temp+1); } } return 0; }
a.cc: In function 'int main()': a.cc:106:11: error: 'class std::queue<std::pair<int, int> >' has no member named 'push_back' 106 | q.push_back(make_pair(i,j)); | ^~~~~~~~~
s887207241
p03725
C++
#include<bits/stdc++.h> using namespace std; long long h,w,k,stx,sty,dist[805][805],x[4]={0,0,1,-1},y[4]={1,-1,0,0},mini=1e9; char g[805][805]; void ff(long long a, long long b) { if(a==1 || a==h || b==1 || b==w || dist[a][b]>=k) { return; } for(long long i=0;i<4;i++) { if(g[a+x[i]][b+y[i]]=='.' && dist[a+x[i]][b+y[i]]==-1 && dist[a][b]<k) { dist[a+x[i]][b+y[i]]=dist[a][b]+1; ff(a+x[i],b+y[i]); } } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); memset(dist,-1,sizeof(dist)); cin>>h>>w>>k; for(long long i=1;i<=h;i++) { for(long long j=1;j<=w;j++) { cin>>g[i][j]; if(g[i][j]=='S') { stx=i; sty=j; if(stx==1 || stx==h || sty==1 || sty==w) { cout<<0<<endl; return 0; } } } } dist[stx][sty]=0; ff(stx,sty); for(long long i=1;i<=h;i++) { for(long long j=1;j<=w;j++) { if(dist[i][j]!=-1) { if(i==1 || i==h || j==1 || j==w) { mini=0; } mini=min(mini,(max(0,i-1-1))/k+1); mini=min(mini,(max(0,h-i-1))/k+1); mini=min(mini,(max(0,j-1-1))/k+1); mini=min(mini,(max(0,w-j-1))/k+1); } } } cout<<mini+1<<endl; }
a.cc: In function 'int main()': a.cc:47:43: error: no matching function for call to 'max(int, long long int)' 47 | mini=min(mini,(max(0,i-1-1))/k+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:47:43: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 47 | mini=min(mini,(max(0,i-1-1))/k+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:47:43: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 47 | mini=min(mini,(max(0,i-1-1))/k+1); | ~~~^~~~~~~~~ a.cc:48:43: error: no matching function for call to 'max(int, long long int)' 48 | mini=min(mini,(max(0,h-i-1))/k+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:48:43: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 48 | mini=min(mini,(max(0,h-i-1))/k+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 /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:48:43: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 48 | mini=min(mini,(max(0,h-i-1))/k+1); | ~~~^~~~~~~~~ a.cc:49:51: error: no matching function for call to 'max(int, long long int)' 49 | mini=min(mini,(max(0,j-1-1))/k+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:49:51: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 49 | mini=min(mini,(max(0,j-1-1))/k+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 /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:49:51: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 49 | mini=min(mini,(max(0,j-1-1))/k+1); | ~~~^~~~~~~~~ a.cc:50:51: error: no matching function for call to 'max(int, long long int)' 50 | mini=min(mini,(max(0,w-j-1))/k+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:50:51: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 50 | mini=min(mini,(max(0,w-j-1))/k+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 /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:50:51: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 50 | mini=min(mini,(max(0,w-j-1))/k+1); | ~~~^~~~~~~~~
s624615656
p03725
C++
#include<bits/stdc++.h> using namespace std; #define SCD(t) scanf("%d",&t) #define SCLD(t) scanf("%ld",&t) #define SCLLD(t) scanf("%lld",&t) #define SCC(t) scanf("%c",&t) #define SCS(t) scanf("%s",t) #define SCF(t) scanf("%f",&t) #define SCLF(t) scanf("%lf",&t) #define MEM(a, b) memset(a, (b), sizeof(a)) #define FOR(i, j, k, in) for (long long i=j ; i<k ; i+=in) #define RFOR(i, j, k, in) for (long long i=j ; i>=k ; i-=in) #define REP(i, j) FOR(i, 0, j, 1) #define RREP(i, j) RFOR(i, j, 0, 1) #define all(cont) cont.begin(), cont.end() #define rall(cont) cont.end(), cont.begin() #define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++) #define IN(A, B, C) assert( B <= A && A <= C) #define MP make_pair #define PB push_back #define INF (long long)1e9 #define EPS 1e-9 #define PI 3.1415926535897932384626433832795 #define MOD 1000000007 #define read(type) readlong long<type>() const double pi=acos(-1.0); typedef pair<long long, long long> PII; typedef vector<long long> VI; typedef vector<string> VS; typedef vector<PII> VII; typedef vector<VI> VVI; typedef map<long long,long long> MPII; typedef set<long long> SETI; typedef multiset<long long> MSETI; typedef long long long long long32; typedef unsigned long long long ulong long32; typedef long long long long long long64; typedef unsigned long long long long ulong long64; long long h,w,k,stx,sty,dist[805][805],x[4]={0,0,1,-1},y[4]={1,-1,0,0},mini=1e9; char g[805][805]; void ff(long long a, long long b) { if(a==1 || a==h || b==1 || b==w || dist[a][b]>=k) { return; } for(long long i=0;i<4;i++) { if(g[a+x[i]][b+y[i]]=='.' && dist[a+x[i]][b+y[i]]==-1 && dist[a][b]<k) { dist[a+x[i]][b+y[i]]=dist[a][b]+1; ff(a+x[i],b+y[i]); } } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); memset(dist,-1,sizeof(dist)); cin>>h>>w>>k; for(long long i=1;i<=h;i++) { for(long long j=1;j<=w;j++) { cin>>g[i][j]; if(g[i][j]=='S') { stx=i; sty=j; if(stx==1 || stx==h || sty==1 || sty==w) { cout<<0<<endl; return 0; } } } } dist[stx][sty]=0; ff(stx,sty); for(long long i=1;i<=h;i++) { for(long long j=1;j<=w;j++) { if(dist[i][j]!=-1) { if(i==1 || i==h || j==1 || j==w) { mini=0; } mini=min(mini,(max(0,i-1-1))/k+1); mini=min(mini,(max(0,h-i-1))/k+1); mini=min(mini,(max(0,j-1-1))/k+1); mini=min(mini,(max(0,w-j-1))/k+1); } } } cout<<mini+1<<endl; }
a.cc:37:19: error: 'long long long' is too long for GCC 37 | typedef long long long long long32; | ^~~~ a.cc:37:24: error: 'long long long' is too long for GCC 37 | typedef long long long long long32; | ^~~~ a.cc:38:28: error: 'long long long' is too long for GCC 38 | typedef unsigned long long long ulong long32; | ^~~~ a.cc:38:39: error: expected initializer before 'long32' 38 | typedef unsigned long long long ulong long32; | ^~~~~~ a.cc:39:19: error: 'long long long' is too long for GCC 39 | typedef long long long long long long64; | ^~~~ a.cc:39:24: error: 'long long long' is too long for GCC 39 | typedef long long long long long long64; | ^~~~ a.cc:39:29: error: 'long long long' is too long for GCC 39 | typedef long long long long long long64; | ^~~~ a.cc:40:28: error: 'long long long' is too long for GCC 40 | typedef unsigned long long long long ulong long64; | ^~~~ a.cc:40:33: error: 'long long long' is too long for GCC 40 | typedef unsigned long long long long ulong long64; | ^~~~ a.cc:40:45: error: expected initializer before 'long64' 40 | typedef unsigned long long long long ulong long64; | ^~~~~~ a.cc: In function 'int main()': a.cc:84:43: error: no matching function for call to 'max(int, long long int)' 84 | mini=min(mini,(max(0,i-1-1))/k+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:84:43: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 84 | mini=min(mini,(max(0,i-1-1))/k+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:84:43: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 84 | mini=min(mini,(max(0,i-1-1))/k+1); | ~~~^~~~~~~~~ a.cc:85:43: error: no matching function for call to 'max(int, long long int)' 85 | mini=min(mini,(max(0,h-i-1))/k+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:85:43: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 85 | mini=min(mini,(max(0,h-i-1))/k+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 /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:85:43: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 85 | mini=min(mini,(max(0,h-i-1))/k+1); | ~~~^~~~~~~~~ a.cc:86:51: error: no matching function for call to 'max(int, long long int)' 86 | mini=min(mini,(max(0,j-1-1))/k+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:86:51: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 86 | mini=min(mini,(max(0,j-1-1))/k+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 /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:86:51: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 86 | mini=min(mini,(max(0,j-1-1))/k+1); | ~~~^~~~~~~~~ a.cc:87:51: error: no matching function for call to 'max(int, long long int)' 87 | mini=min(mini,(max(0,w-j-1))/k+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:87:51: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 87 | mini=min(mini,(max(0,w-j-1))/k+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 /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:87:51: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 87 | mini=min(mini,(max(0,w-j-1))/k+1); | ~~~^~~~~~~~~
s815250052
p03725
C++
//Littleboy123 Template 1.1 #include <bits/stdc++.h> using namespace std; //pragmas /* #pragma comment(linker, "/stack:200000000") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC target ("avx2") #pragma GCC optimization ("Ofast") #pragma GCC optimization ("unroll-loops") */ typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; #define FOR(a,b,c) for(ll (a)=(b);(a)<(c);++(a)) #define FORE(a,b,c) for(ll (a)=(b);(a)<=(c);++(a)) #define FORN(a,b,c) for(ll (a)=(b);(a)>(c);--(a)) #define FORNE(a,b,c) for(ll (a)=(b);(a)>=(c);--(a)) #define COUT(a) cout << (a) << '\n' #define MEM(a,b) memset((a), (b), sizeof((a))) #define MAX(a,b) (a) = max((a), (b)) #define MIN(a,b) (a) = min((a), (b)) #define nl '\n' #define fi first #define se second #define mp make_pair #define pb push_back #define pi acos(-1.0) void init(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } //End of template int n, m, k; char arr[805][805]; int lompati[805][805]; int dr[] = {0, 1, 0, -1}; int dc[] = {1, 0, -1, 0}; int main(){ init(); //debug /* ifstream in("input.in"); streambuf *cinbuf = std::cin.rdbuf(); cin.rdbuf(in.rdbuf()); ofstream out("out.txt"); streambuf *coutbuf = std::cout.rdbuf(); cout.rdbuf(out.rdbuf()); */ //end debug cin >> n >> m >> k; int x, y; FOR(i, 0, n){ FOR(j, 0, m){ cin >> arr[i][j]; if(arr[i][j] == 'S'){ x = i; y = j; } } } FOR(i, 0, 805){ FOR(j, 0, 805) lompati[i][j] = 0; } int count = 0; queue<pair<ii, int>> q; q.push(mp(mp(x, y), k)); arr[x][y] = '&'; queue<pair<ii, int>> lock; queue<pair<ii, int>> akhir; int rem; int nemu = 0; int find = 0; while(true){ count++; while(q.empty() == false){ x = q.front().fi.fi; y = q.front().fi.se; rem = q.front().se; q.pop(); if(x == 0 || x == n-1 || y == 0 || y == m-1){ nemu = 1; break; } if(rem == 0){ lock.push(mp(mp(x, y), k)); akhir.push(mp(mp(x, y), k)); continue; } find = 0; FOR(i, 0, 4){ if(x + dr[i] < 0 || x + dr[i] > n || y + dc[i] < 0 || y + dc[i] > m) continue; if(arr[x+dr[i]][y+dc[i]] == '.'){ find++; arr[x+dr[i]][y+dc[i]] = '&'; q.push(mp(mp(x+dr[i], y+dc[i]), rem-1)); } } if(find == 0){ lock.push(mp(mp(x, y), k)); akhir.push(mp(mp(x, y), k)); continue; } } if(nemu == 1) break; while(lock.empty() == false){ x = lock.front().fi.fi; y = lock.front().fi.se; rem = lock.front().se; lock.pop(); if(rem == 0) continue; FOR(i, 0, 4){ if(x + dr[i] < 0 || x + dr[i] > n || y + dc[i] < 0 || y + dc[i] > m) continue; if(arr[x+dr[i]][y+dc[i]] == '#'){ arr[x+dr[i]][y+dc[i]] = '.'; lock.push(mp(mp(x+dr[i], y+dc[i]), rem-1)); } else if(arr[x+dr[i]][y+dc[i]] == '.' && lompati[x+dr[i]][y+dc[i]] == 0){ lompati[x+dr[i]][y+dc[i]] == 1 lock.push(mp(mp(x+dr[i], y+dc[i]), rem)); } } } while(akhir.empty() == false){ q.push(akhir.front()); akhir.pop(); } } cout << count << nl; return 0; }
a.cc: In function 'int main()': a.cc:139:71: error: expected ';' before 'lock' 139 | lompati[x+dr[i]][y+dc[i]] == 1 | ^ | ; 140 | lock.push(mp(mp(x+dr[i], y+dc[i]), rem)); | ~~~~
s527287952
p03725
C++
//Littleboy123 Template 1.1 #include <bits/stdc++.h> using namespace std; //pragmas /* #pragma comment(linker, "/stack:200000000") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC target ("avx2") #pragma GCC optimization ("Ofast") #pragma GCC optimization ("unroll-loops") */ typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; #define FOR(a,b,c) for(ll (a)=(b);(a)<(c);++(a)) #define FORE(a,b,c) for(ll (a)=(b);(a)<=(c);++(a)) #define FORN(a,b,c) for(ll (a)=(b);(a)>(c);--(a)) #define FORNE(a,b,c) for(ll (a)=(b);(a)>=(c);--(a)) #define COUT(a) cout << (a) << '\n' #define MEM(a,b) memset((a), (b), sizeof((a))) #define MAX(a,b) (a) = max((a), (b)) #define MIN(a,b) (a) = min((a), (b)) #define nl '\n' #define fi first #define se second #define mp make_pair #define pb push_back #define pi acos(-1.0) void init(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } //End of template int n, m, k; char arr[805][805]; int lompati[805][805]; int dr[] = {0, 1, 0, -1}; int dc[] = {1, 0, -1, 0}; int main(){ init(); //debug /* ifstream in("input.in"); streambuf *cinbuf = std::cin.rdbuf(); cin.rdbuf(in.rdbuf()); ofstream out("out.txt"); streambuf *coutbuf = std::cout.rdbuf(); cout.rdbuf(out.rdbuf()); */ //end debug cin >> n >> m >> k; int x, y; FOR(i, 0, n){ FOR(j, 0, m){ cin >> arr[i][j]; if(arr[i][j] == 'S'){ x = i; y = j; } } } FOR(i, 0, 805){ FOR(j, 0, 805) lompati[i][j] = 0; } int count = 0; queue<pair<ii, int>> q; q.push(mp(mp(x, y), k)); arr[x][y] = '&'; queue<pair<ii, int>> lock; queue<pair<ii, int>> akhir; int rem; int nemu = 0; int find = 0; while(true){ count++; while(q.empty() == false){ x = q.front().fi.fi; y = q.front().fi.se; rem = q.front().se; q.pop(); if(x == 0 || x == n-1 || y == 0 || y == m-1){ nemu = 1; break; } if(rem == 0){ lock.push(mp(mp(x, y), k)); akhir.push(mp(mp(x, y), k)); continue; } find = 0; FOR(i, 0, 4){ if(x + dr[i] < 0 || x + dr[i] > n || y + dc[i] < 0 || y + dc[i] > m) continue; if(arr[x+dr[i]][y+dc[i]] == '.'){ find++; arr[x+dr[i]][y+dc[i]] = '&'; q.push(mp(mp(x+dr[i], y+dc[i]), rem-1)); } } if(find == 0){ lock.push(mp(mp(x, y), k)); akhir.push(mp(mp(x, y), k)); continue; } } if(nemu == 1) break; while(lock.empty() == false){ x = lock.front().fi.fi; y = lock.front().fi.se; rem = lock.front().se; lock.pop(); if(rem == 0) continue; FOR(i, 0, 4){ if(x + dr[i] < 0 || x + dr[i] > n || y + dc[i] < 0 || y + dc[i] > m) continue; if(arr[x+dr[i]][y+dc[i]] == '#'){ arr[x+dr[i]][y+dc[i]] = '.'; lock.push(mp(mp(x+dr[i], y+dc[i]), rem-1)); } else if(arr[x+dr[i]][y+dc[i]] == '.' && lompati[x+dr[i]][y+dc[i]] == 0){ lompati[x+dr[i]][y+dc[i]] == 1 lock.push(mp(mp(x+dr[i], y+dc[i]), rem-1)); } } } while(akhir.empty() == false){ q.push(akhir.front()); akhir.pop(); } } cout << count << nl; return 0; }
a.cc: In function 'int main()': a.cc:139:71: error: expected ';' before 'lock' 139 | lompati[x+dr[i]][y+dc[i]] == 1 | ^ | ; 140 | lock.push(mp(mp(x+dr[i], y+dc[i]), rem-1)); | ~~~~
s264396580
p03725
C++
#include<bits/stdc++.h> using namespace std; #define REPP(i,a,b,c) for(int i=a; i<=b; i+=c) #define REP(i,a,b) REPP(i,a,b,1) #define REVV(i,a,b,c) for(int i=a; i>=b; i-=c) #define REV(i,a,b) REVV(i,a,b,1) #define FOR(i,a) REP(i,0,(int)a-1) #define FORD(i,a) REV(i,(int)a-1,0) #define PB push_back #define POB pop_back #define FI first #define SE second #define MP make_pair typedef long long ll; typedef unsigned long long ull; typedef pair < int , int > pii; typedef vector < int > vi; typedef vector < pii > vii; typedef vector < ll > vl; typedef pair < ll , ll > pll; const double PI = acos(-1); const ll MOD = 1e9 + 7; const double EPS = 1e-9; const int INF = 1e9; ll addMod(ll a, ll b){ if(a + b >= MOD) return a + b - MOD; return a + b; } ll mulMod(ll a, ll b){ return (a*b)%MOD; } ll fast(ll a, ll b){ if(b == 0) return 1; ll tmp = fast(a,b/2); tmp = mulMod(tmp,tmp); if(b & 1) tmp = mulMod(tmp,a); return tmp; } ll GCD(ll a, ll b){ if(a > b) return GCD(b,a); if(a == 0) return b; return GCD(b%a,a); } ////////////////////////////////////////////// const int N = 800; int dy[] = {-1,1,0,0}; int dx[] = {0,0,-1,1}; pii st; int r,c,k; string M[N + 5]; bool vis[N + 5][N + 5]; bool inRange(int y, int x){ return y >= 0 && y < r && x >= 0 && x < c; } int solve(){ queue < pair < pii , int > > q; while(!q.empty()) q.pop(); q.push(st); int y,x,yy,xx,ret = INF,mn,val,move; while(!q.empty()){ y = q.front().FI.FI; x = q.front().FI.SE; move = q.front().SE; q.pop(); if(vis[y][x]) continue; if(y == 0 || y == r - 1 || x == 0 || x == c-1) return 1; vis[y][x] = true; mn = min(min(x,c-x-1), min(y, r-y-1)); val = 0; if(mn % k > 0) val = 1; val += mn / k; ret = min(ret, val+1); if(move == 0) continue; FOR(i,4){ yy = y + dy[i]; xx = x + dx[i]; if(inRange(yy,xx) && !vis[yy][xx] && M[yy][xx] == '.'){ q.push(MP(MP(yy,xx),move-1)); } } } return ret; } int main(){ ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> r >> c >> k; FOR(i,r){ cin >> M[i]; FOR(j,c){ if(M[i][j] == 'S'){ st = MP(i,j); } } } cout << solve() << endl; return 0; }
a.cc: In function 'int solve()': a.cc:70:15: error: no matching function for call to 'std::queue<std::pair<std::pair<int, int>, int> >::push(pii&)' 70 | q.push(st); | ~~~~~~^~~~ In file included from /usr/include/c++/14/queue:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157, from a.cc:1: /usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<std::pair<int, int>, int>; _Sequence = std::deque<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int> > >; value_type = std::pair<std::pair<int, int>, int>]' 283 | push(const value_type& __x) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:283:30: note: no known conversion for argument 1 from 'pii' {aka 'std::pair<int, int>'} to 'const std::queue<std::pair<std::pair<int, int>, int> >::value_type&' {aka 'const std::pair<std::pair<int, int>, int>&'} 283 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::pair<std::pair<int, int>, int>; _Sequence = std::deque<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int> > >; value_type = std::pair<std::pair<int, int>, int>]' 288 | push(value_type&& __x) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:288:25: note: no known conversion for argument 1 from 'pii' {aka 'std::pair<int, int>'} to 'std::queue<std::pair<std::pair<int, int>, int> >::value_type&&' {aka 'std::pair<std::pair<int, int>, int>&&'} 288 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~
s287779412
p03725
C++
#include<iostream> #include<string> #include<cstdio> #include<vector> #include<cmath> #include<algorithm> #include<functional> #include<iomanip> #include<queue> #include<ciso646> #include<random> #include<map> #include<set> #include<complex> #include<bitset> #include<stack> #include<unordered_map> #include<utility> #include<cassert> #include "cxx-prettyprint/prettyprint.hpp" using namespace std; const int MOD = 1000000007; typedef pair<int, int> P; typedef long long ll; #define rep(i, n) for(int i=0;i<n;i++) #define rep2(i, m, n) for(int i=m;i<n;i++) #define rrep(i, n, m) for(int i=n;i>=m;i--) using Graph = vector<vector<int>>; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; int main() { cin.tie(0); ios::sync_with_stdio(false); int H, W, K; cin >> H >> W >> K; vector<string> A; int diff = 1000000; vector<vector<bool>> visited(H, vector<bool>(W, false)); P start; for (int i = 0; i < H; ++i) { string s; cin >> s; A.push_back(s); for (int j = 0; j < W; ++j) { if (s[j] == 'S') { start = {i, j}; diff = min(min(i, H - 1 - i), min(j, W - 1 - j)); visited[i][j] = true; } } } deque<P> queue; queue.push_back(start); while (!queue.empty()) { P q = queue.front(); queue.pop_front(); for (int i = 0; i < 4; ++i) { int x = dx[i]; int y = dy[i]; int a = q.first; int b = q.second; if (abs(a - start.first) + abs(b - start.second) > K) { continue; } int tmp = min(min(a, H - 1 - a), min(b, W - 1 - b)); if (tmp < diff){ diff = tmp; } if ((0 <= a + y && a + y <= H - 1) && 0 <= b + x && b + x <= W - 1) { if (visited[a + y][b + x] || A[a + y][b + x] != '.') { continue; } else { queue.push_back({a + y, b + x}); visited[a + y][b + x] = true; } } } } int ans = 1; if (diff == 0) { cout << ans << endl; } else { cout << ans + ((K - 1) + diff) / K << endl; } }
a.cc:20:10: fatal error: cxx-prettyprint/prettyprint.hpp: No such file or directory 20 | #include "cxx-prettyprint/prettyprint.hpp" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s903911843
p03725
C++
https://atcoder.jp/contests/agc014/standings#include<iostream> #include<string> #include<algorithm> #include<vector> #include<queue> #include<map> #include<math.h> #include<iomanip> #include<set> #include<numeric> #include<cstring> #include<cstdio> #include<functional> #include<bitset> #include<limits.h> #include<cassert> #include <fstream> #include <time.h> #include <iterator> #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 SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); #define REVERSE(v,n) reverse(v,v+n); #define VREVERSE(v) reverse(v.begin(), v.end()); #define ll long long #define pb(a) push_back(a) #define m0(x) memset(x,0,sizeof(x)) #define print(x) cout<<x<<endl; #define pe(x) cout<<x<<" "; #define lb(v,n) lower_bound(v.begin(), v.end(), n); #define ub(v,n) upper_bound(v.begin(), v.end(), n); #define int long long #define all(x) (x).begin(), (x).end() using namespace std; int MOD = (ll)1000000000 + 7; const ll INF = 1e17; const double pi = acos(-1); const double EPS = 1e-10; typedef pair<int, int>P; const int MAX = 200020; int dx[4] = { 0,0,1,-1 }; int dy[4] = { 1,-1,0,0 }; bool visited[1000][1000]; char A[1000][1000]; int H, W,K; int dfs(int x,int y,int n) { visited[x][y] = true; if (n == 0) { return min({ x,H - x - 1,y,W - y- 1 }); } int res = min({ x,H - x - 1,y,W - y-1 }); REP(i, 4) { int nx = x + dx[i]; int ny = y + dy[i]; if (nx >= 0 && nx < H && ny >= 0 && ny < W) { if (visited[nx][ny])continue; if (A[nx][ny] != '#') { res=min(res,dfs(nx, ny, n - 1)); } } } return res; } void solve() { cin >> H >> W>>K; int sx, sy; REP(i, H) { REP(j, W) { cin >> A[i][j]; if (A[i][j] == 'S') { sx = i, sy = j; } } } int rem = dfs(sx, sy, K); int ans = 1; ans += (rem + K - 1) / K; print(ans); } signed main() { cin.tie(0); ios::sync_with_stdio(false); solve(); }
a.cc:1:1: error: 'https' does not name a type 1 | https://atcoder.jp/contests/agc014/standings#include<iostream> | ^~~~~ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/char_traits.h:50: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared 144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type 146 | static _GLIBCXX14_CONSTEXPR std::size_t | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared 150 | find(const char_type* __s, std::size_t __n, const char_type& __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared 153 | move(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared 156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared 159 | assign(char_type* __s, std::size_t __n, char_type __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared 187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n) | ^~~ /usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)': /usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~ | __n /usr/include/c++/14/bits/char_traits.h: At global scope: /usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std' does not name a type 198 | _GLIBCXX14
s891722249
p03725
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) using P=pair<int,int>; int inf=1e9; queue<P> que; vector<int>dx={0,0,1,-1}; vector<int>dy={1,-1,0,0}; int main(){ int h,w,k;cin>>h>>w>>k; vector<string>a(h); for(auto&& u:a)cin>>u; vector<vector<int>>d(h,vector<int>(w,inf)); rep(i,h)rep(j,w)if(a[i][j]=='S'){que.push(make_pair(i,j));d[i][j]=0;} while(!que.empty()){ P z=que.front();que.pop(); rep(i,4){ int x,y;x=z.first+dx[i];y=z.second+dy[i]; if(x<0||x>=h||y<0||y>=w)continue; if(d[x][y]==inf&&s[x][y]=='.' ){ d[x][y]=d[z.first][z.second]+1; que.push(make_pair(x,y)); } } } int mn=inf; rep(i,h)rep(j,w){if(d[i][j]<=k)mn=min({mn,i,j,h-1-i,w-1-j});} cout<<(mn-1)/k+2<<endl; }
a.cc: In function 'int main()': a.cc:21:42: error: 's' was not declared in this scope 21 | if(d[x][y]==inf&&s[x][y]=='.' ){ | ^
s979857864
p03725
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) using P=pair<int,int>; int inf=1e9; queue<P> que; vector<int>dx={0,0,1,-1}; vector<int>dy={1,-1,0,0}; int main(){ int h,w,k;cin>>h>>w>>k; vector<string>a(h); for(auto&& u:a)cin>>u; vector<vector<int>>d(h,vector<int>(w,inf)); rep(i,h)rep(j,w)if(a[i][j]=='S'){que.push(make_pair(i,j));d[i][j]=0;} while(!que.empty()){ P z=que.front();que.pop(); rep(i,4){ int x,y;x=z.first+dx[i];y=z.second+dy[i]; if(x<0||x>=h||y<0||y>=h)continue; if(d[x][y]==inf&&s[x][y]=='.' ){ d[x][y]=d[z.first][z.second]+1; que.push(make_pair(x,y)); } } } int mn=inf; rep(i,h)rep(j,w){if(d[i][j]<=k)mn=min({mn,i,j,h-1-i,w-1-j});} cout<<(mn-1)/k+2<<endl; }
a.cc: In function 'int main()': a.cc:21:42: error: 's' was not declared in this scope 21 | if(d[x][y]==inf&&s[x][y]=='.' ){ | ^
s642026592
p03725
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) using P=pair<int,int>; int inf=1e9; queue<P> que; vector<int>dx={0,0,1,-1}; vector<int>dy={1,-1,0,0}; int main(){ int h,w,k;cin>>h>>w>>k; vector<string>a(h); for(auto&& u:a)cin>>u; vector<vector<int>>d(h,vector<int>(w,inf)); rep(i,h)rep(j,w)if(a[i][j]=='S'){que.push(make_pair(i,j));d[i][j]=0;} while(!que.empty()){ P z=que.front();que.pop(); rep(i,4){ int x,y;x=z.first+dx[i];y=z.second+dy[i]; if(x<0||x>=h||y<0||y>=h)continue; if(d[x][y]==inf){ d[x][y]=d[z.first][z.second]+1; que.push(make_pair(x,y)); } } int mn=inf; rep(i,h)mn=min({mn,d[i][0],d[i][w-1]}); rep(i,w)mn=min({mn,d[0][i],d[h-1][i]}); cout<<(mn-1)/k+1<<endl; }
a.cc: In function 'int main()': a.cc:31:2: error: expected '}' at end of input 31 | } | ^ a.cc:10:11: note: to match this '{' 10 | int main(){ | ^
s599471511
p03725
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) using P=pair<int,int>; int inf=1e9; queue<P> que; vector<int>dx={0,0,1,-1}; vector<int>dy={1,-1,0,0}; int main(){ int h,w,k;cin>>h>>w>>k; vector<string>a(h); for(auto&& u:a)cin>>u; vector<vector<int>>d(h,vector<int>(w,inf)); rep(i,h)rep(j,w)if(a[i][j]=='S'){que.push(make_pair(i,j));d[i][j]=0;} while(!que.empty()){ P z=que.top();que.pop(); rep(i,4){ int x,y;x=z.first+dx[i];y=z.second+dy[i]; if(x<0||x>=h||y<0||y>=h)continue; if(d[x][y]==inf){ d[x][y]=d[z.first][z.second]+1; que.push(make_pair(x,y)); } } int mn=inf; rep(i,h)mn=min({mn,d[i,0],d[i,w-1]}); rep(i,w)mn=min({mn,d[0,i],d[h-1,i]}); cout<<(mn-1)/k+1<<endl; }
a.cc: In function 'int main()': a.cc:17:25: error: 'class std::queue<std::pair<int, int> >' has no member named 'top'; did you mean 'pop'? 17 | P z=que.top();que.pop(); | ^~~ | pop a.cc:28:23: error: no matching function for call to 'min(<brace-enclosed initializer list>)' 28 | rep(i,h)mn=min({mn,d[i,0],d[i,w-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: candidate expects 2 arguments, 1 provided /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, 1 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: template argument deduction/substitution failed: a.cc:28:23: note: deduced conflicting types for parameter '_Tp' ('int' and 'std::vector<int>') 28 | rep(i,h)mn=min({mn,d[i,0],d[i,w-1]}); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /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: candidate expects 2 arguments, 1 provided a.cc:29:23: error: no matching function for call to 'min(<brace-enclosed initializer list>)' 29 | rep(i,w)mn=min({mn,d[0,i],d[h-1,i]}); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /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: candidate expects 2 arguments, 1 provided /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, 1 provided /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: template argument deduction/substitution failed: a.cc:29:23: note: deduced conflicting types for parameter '_Tp' ('int' and 'std::vector<int>') 29 | rep(i,w)mn=min({mn,d[0,i],d[h-1,i]}); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /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: candidate expects 2 arguments, 1 provided a.cc:31:2: error: expected '}' at end of input 31 | } | ^ a.cc:10:11: note: to match this '{' 10 | int main(){ | ^
s322672220
p03725
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) using P=pair<int,int>; int inf=1e9; queue<P> que; vector<int>dx={0,0,1,-1}; vector<int>dy={1,-1,0,0}; int main(){ int h,w,k;cin>>h>>w>>k; vector<string>a(h); for(auto&& u:a)cin>>u; vector<vector<int>>d(h,vector<int>(w,inf)); rep(i,h)rep(j,w)if(a[i][j]=='S'){que.push(i,j);d[i][j]=0;} while(!que.empty()){ P z=que.top();que.pop(); rep(i,4){ int x,y;x=z.first+dx[i];y=z.second+dy[i]; if(x<0||x>=h||y<0||y>=h)continue; if(d[x][y]==inf){ d[x][y]=d[z.first][z.second]+1; que.push(make_pair(x,y)); } } int mn=inf; rep(i,h)mn=min({mn,d[i,0],d[i,w-1]}); rep(i,w)mn=min({mn,d[0,i],d[h-1,i]}); cout<<(mn-1)/k+1<<endl; }
a.cc: In function 'int main()': a.cc:15:50: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(int&, int&)' 15 | rep(i,h)rep(j,w)if(a[i][j]=='S'){que.push(i,j);d[i][j]=0;} | ~~~~~~~~^~~~~ In file included from /usr/include/c++/14/queue:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157, from a.cc:1: /usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; value_type = std::pair<int, int>]' 283 | push(const value_type& __x) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; value_type = std::pair<int, int>]' 288 | push(value_type&& __x) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate expects 1 argument, 2 provided a.cc:17:25: error: 'class std::queue<std::pair<int, int> >' has no member named 'top'; did you mean 'pop'? 17 | P z=que.top();que.pop(); | ^~~ | pop a.cc:28:23: error: no matching function for call to 'min(<brace-enclosed initializer list>)' 28 | rep(i,h)mn=min({mn,d[i,0],d[i,w-1]}); | ~~~^~~~~~~~~~~~~~~~~~~~~~ In file included 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_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: candidate expects 2 arguments, 1 provided /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, 1 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: template argument deduction/substitution failed: a.cc:28:23: note: deduced conflicting types for parameter '_Tp' ('int' and 'std::vector<int>') 28 | rep(i,h)mn=min({mn,d[i,0],d[i,w-1]}); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /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: candidate expects 2 arguments, 1 provided a.cc:29:23: error: no matching function for call to 'min(<brace-enclosed initializer list>)' 29 | rep(i,w)mn=min({mn,d[0,i],d[h-1,i]}); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /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: candidate expects 2 arguments, 1 provided /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, 1 provided /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: template argument deduction/substitution failed: a.cc:29:23: note: deduced conflicting types for parameter '_Tp' ('int' and 'std::vector<int>') 29 | rep(i,w)mn=min({mn,d[0,i],d[h-1,i]}); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /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: candidate expects 2 arguments, 1 provided a.cc:31:2: error: expected '}' at end of input 31 | } | ^ a.cc:10:11: note: to match this '{' 10 | int main(){ | ^
s923378289
p03725
C++
use std::cmp; use std::collections::VecDeque; const INF: i32 = 1e9 as i32; const DIR: [(i32, i32); 4] = [(0, -1), (0, 1), (-1, 0), (1, 0)]; fn main() { let s = std::io::stdin(); let mut sc = Scanner { stdin: s.lock() }; let h: usize = sc.read(); let w: usize = sc.read(); let k: i32 = sc.read(); let board: Vec<_> = (0..h).map(|_| sc.chars()).collect(); let mut dist = vec![vec![INF; w]; h]; let mut si = 0; let mut sj = 0; for i in 0..h { for j in 0..w { if board[i][j] == 'S' { dist[i][j] = 0; si = i; sj = j; } } } let mut q = VecDeque::new(); q.push_back((0, 0, si, sj)); for _ in 0.. { let mut next_q = VecDeque::new(); while let Some((time, open, i, j)) = q.pop_front() { if i == h - 1 || j == w - 1 || i == 0 || j == 0 { let turn = (time + k - 1) / k; println!("{}", turn); return; } for (di, dj) in DIR.iter().cloned() { let ni = (i as i32) + di; let nj = (j as i32) + dj; if ni < 0 || nj < 0 { continue; } let ni = ni as usize; let nj = nj as usize; if ni >= h || nj >= w { continue; } if board[ni][nj] == '#' && open > 0 && dist[ni][nj] > time + 1 { dist[ni][nj] = time + 1; if (time + 1) % k == 0 { next_q.push_back((time + 1, k, ni, nj)); } else { q.push_back((time + 1, open - 1, ni, nj)); } } else if board[ni][nj] == '.' && dist[ni][nj] > time + 1 { dist[ni][nj] = time + 1; if (time + 1) % k == 0 { next_q.push_back((time + 1, k, ni, nj)); } else { q.push_back((time + 1, open, ni, nj)); } } } let next_time = (time + k) / k * k; next_q.push_front((next_time, k, i, j)); } q = next_q; } } pub struct Scanner<R> { stdin: R, } impl<R: std::io::Read> Scanner<R> { pub fn read<T: std::str::FromStr>(&mut self) -> T { use std::io::Read; let buf = self .stdin .by_ref() .bytes() .map(|b| b.unwrap()) .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r') .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r') .collect::<Vec<_>>(); unsafe { std::str::from_utf8_unchecked(&buf) } .parse() .ok() .expect("Parse error.") } pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.read()).collect() } pub fn chars(&mut self) -> Vec<char> { self.read::<String>().chars().collect() } }
a.cc:13:26: error: too many decimal points in number 13 | let board: Vec<_> = (0..h).map(|_| sc.chars()).collect(); | ^~~~ a.cc:18:14: error: too many decimal points in number 18 | for i in 0..h { | ^~~~ a.cc:19:18: error: too many decimal points in number 19 | for j in 0..w { | ^~~~ a.cc:30:14: error: too many decimal points in number 30 | for _ in 0.. { | ^~~ a.cc:95:10: error: too many decimal points in number 95 | (0..n).map(|_| self.read()).collect() | ^~~~ a.cc:1:1: error: 'use' does not name a type 1 | use std::cmp; | ^~~ a.cc:2:1: error: 'use' does not name a type 2 | use std::collections::VecDeque; | ^~~ a.cc:4:10: error: found ':' in nested-name-specifier, expected '::' 4 | const INF: i32 = 1e9 as i32; | ^ | :: a.cc:4:7: error: 'INF' does not name a type 4 | const INF: i32 = 1e9 as i32; | ^~~ a.cc:5:7: error: 'DIR' does not name a type 5 | const DIR: [(i32, i32); 4] = [(0, -1), (0, 1), (-1, 0), (1, 0)]; | ^~~ a.cc:5:25: error: expected unqualified-id before numeric constant 5 | const DIR: [(i32, i32); 4] = [(0, -1), (0, 1), (-1, 0), (1, 0)]; | ^ a.cc:7:1: error: 'fn' does not name a type 7 | fn main() { | ^~ a.cc:74:1: error: 'pub' does not name a type 74 | pub struct Scanner<R> { | ^~~ a.cc:78:1: error: 'impl' does not name a type 78 | impl<R: std::io::Read> Scanner<R> { | ^~~~
s262616050
p03725
C++
#include<bits/stdc++.h> using namespace std; bool use[800][800]; int dx={0,0,1,-1}; int dy={1,-1,0,0}; void dfs(int x,int y) { if(use[x][y] || s[x][y]=="#") return; if(x==0 || x==h-1 || y==0 || y==w-1) return res; else for(int i=0;i<4;i++) { dfs(x+dx[i],y+dy[i]); } } int close(string s[],int n,int w) { } int main() { cin>>h>>w>>k; for(int i=0;i<h;i++) cin>>s[i]; }
a.cc:4:5: error: scalar object 'dx' requires one element in initializer 4 | int dx={0,0,1,-1}; | ^~ a.cc:5:5: error: scalar object 'dy' requires one element in initializer 5 | int dy={1,-1,0,0}; | ^~ a.cc: In function 'void dfs(int, int)': a.cc:8:25: error: 's' was not declared in this scope 8 | if(use[x][y] || s[x][y]=="#") | ^ a.cc:10:23: error: 'h' was not declared in this scope 10 | if(x==0 || x==h-1 || y==0 || y==w-1) | ^ a.cc:10:41: error: 'w' was not declared in this scope 10 | if(x==0 || x==h-1 || y==0 || y==w-1) | ^ a.cc:11:16: error: 'res' was not declared in this scope 11 | return res; | ^~~ a.cc: In function 'int close(std::string*, int, int)': a.cc:20:1: warning: no return statement in function returning non-void [-Wreturn-type] 20 | } | ^ a.cc: In function 'int main()': a.cc:23:14: error: 'h' was not declared in this scope 23 | cin>>h>>w>>k; | ^ a.cc:23:17: error: 'w' was not declared in this scope 23 | cin>>h>>w>>k; | ^ a.cc:23:20: error: 'k' was not declared in this scope 23 | cin>>h>>w>>k; | ^ a.cc:25:14: error: 's' was not declared in this scope 25 | cin>>s[i]; | ^
s420808455
p03725
C++
#include<bits/stdc++.h> using namespace std; const int maxn=5000; int n,m,k; char iomap[maxn][maxn]; pair<int,int> start; int step[maxn][maxn]; bool vis[maxn][maxn]; bool islegal(pair<int,int> p) { return (!p.first||!p.second||p.first>=n-1||p.second>=m-1); } void dfs(pair<int,int> p) { if(islegal(p)) { cout<<step[p.first][p.second]<<endl; exit(0); } if(step[p.first+2][p.second]==inf) { step[p.first+2][p.second]=step[p.first][p.second]; dfs(make_pair(p.first+2,p.second)); } if(step[p.first-2][p.second]==inf) { step[p.first-2][p.second]=step[p.first][p.second]; dfs(make_pair(p.first-2.p.second)); } } int main() { scanf("%d%d%d",&n,&m,&k); for(int i=0;i<n;i++) for(int j=0;j<m;j++) { cin>>iomap[i][j]; if(iomap[i][j]=='S') start=make_pair(i,j); vis[i][j]=false; } vis[start.first][start.second]=true; step[start.first][start.second]=0; dfs(start); return 0; }
a.cc: In function 'void dfs(std::pair<int, int>)': a.cc:20:39: error: 'inf' was not declared in this scope; did you mean 'ynf'? 20 | if(step[p.first+2][p.second]==inf) | ^~~ | ynf a.cc:25:39: error: 'inf' was not declared in this scope; did you mean 'ynf'? 25 | if(step[p.first-2][p.second]==inf) | ^~~ | ynf a.cc:28:39: error: unable to find numeric literal operator 'operator""p.second' 28 | dfs(make_pair(p.first-2.p.second)); | ^~~~~~~~~~
s376263127
p03725
C++
#include<bits/stdc++.h> const int maxn=8e2+10; using namespace std; char a[maxn][maxn]; int stmp[maxn][maxn];//代表这是bfs的第几步 int direction[4][2]={1,0,-1,0,0,1,0,-1};//四个方向 int n,m,k; int ans=99999999; bool check(int x,int y)//判断这个点是否可行 { if(x>=0&&x<n&&y>=0&&y<m&&stmp[x][y]==0&&a[x][y]=='.') { return 1; } return 0; } queue<pair<int,int> >po; int main() { cin>>n>>m>>k; int sx,sy; for(int i=0;i<n;i++)//输入顺便找到起点 { for(int j=0;j<m;j++) { printf("%c",a[i][j]); if(a[i][j]=='S') { sx=i; sy=j; } } getchar(); } stmp[sx][sy]=1; po.push(make_pair(sx,sy)); while(!po.empty()) { int x=po.front().first; int y=po.front().second; ans=min(ans,min(min(x,n-x-1),min(y,m-y-1))); po.pop(); for(int i=0;i<4;i++) { int xx=x+posi[i][0]; int yy=y+posi[i][1]; if(check(xx,yy)&&stmp[x][y]<=k) { stmp[xx][yy]=stmp[x][y]+1; po.push(make_pair(xx,yy)); } } } int anss; anss=1+(ans+k-1)/k;//向上取整 cout<<anss<<endl; return 0; }
a.cc: In function 'int main()': a.cc:45:22: error: 'posi' was not declared in this scope 45 | int xx=x+posi[i][0]; | ^~~~
s942936927
p03725
C++
#include<bits/stdc++.h> using namespace std; const int INF = 1000000007; int di[4] = {-1, 0, 1, 0}; int dj[4] = {0, 1, -1, 0}; void dfs(int i, int j, vector<vector<bool> > &G, vector<pair<int, int> > &ans){ ans.push_back({i, j}); if(k == 0) return; for(int h = 0; h < 4; h++){ int ni = i + di[h]; int nj = j + dj[h]; if(G[ni][nj]){ G[i][j] = false; dfs(ni, nj, G, ans, k - 1); } } } int main(){ int h, w, k; cin >> h >> w >> k; vector<vector<bool> > G(h + 2, vector<bool> (w + 2, false)); int si, sj; for(int i = 1; i <= h; i++){ for(int j = 1; j <= w; j++){ char in; cin >> in; if(in == '#') continue; G[i][j] = true; if(in == 'S'){ si = i; sj = j; } } } vector<pair<int, int> > ans; G[si][sj] = false; dfs(si, sj, G, ans, k); int anss = INF; for(int i = 0; i < ans.size(); i++){ int tmp = min(min(ans[i].first - 1, ans[i].second - 1), min(h - ans[i].first, w - ans[i].second)); anss = min(anss, 2 + (tmp - 1) / k); if(tmp == 0) anss = 1; } cout << anss << endl; return 0; }
a.cc: In function 'void dfs(int, int, std::vector<std::vector<bool> >&, std::vector<std::pair<int, int> >&)': a.cc:11:8: error: 'k' was not declared in this scope 11 | if(k == 0) return; | ^ a.cc:18:33: error: 'k' was not declared in this scope 18 | dfs(ni, nj, G, ans, k - 1); | ^ a.cc: In function 'int main()': a.cc:45:8: error: too many arguments to function 'void dfs(int, int, std::vector<std::vector<bool> >&, std::vector<std::pair<int, int> >&)' 45 | dfs(si, sj, G, ans, k); | ~~~^~~~~~~~~~~~~~~~~~~ a.cc:8:6: note: declared here 8 | void dfs(int i, int j, vector<vector<bool> > &G, vector<pair<int, int> > &ans){ | ^~~
s704535623
p03725
C++
#include <iostream> #include <algorithm> #include <vector> #include <map> #include <set> #include <string> #include <cmath> #include <iomanip> #include <queue> #include <unordered_map> #include <unordered_set> #include <bitset> #include <climits> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define SORT(c) sort((c).begin(), (c).end()) typedef long long ll; typedef pair<int, int> P; typedef vector<int> V; typedef map<int, int> M; constexpr ll INF = 1e18; constexpr ll MOD = 1e9 + 7; constexpr int dx[] = {0, 0, 1, -1}; constexpr int dy[] = {1, -1, 0, 0}; int div_up(int a, int b) { return (a + b - 1) / b; } int main() { ios::sync_with_stdio(false); cin.tie(0); int h, w, k, fh, fw; string a[810]; cin >> h >> w >> k; REP(i, h) cin >> a[i]; REP(i, h) REP(j, w) if (a[i][j] == 'S') fh = i, fw = j; vector<P> v; int dis[810][810]; memset(dis, -1, sizeof(dis)); dis[fh][fw] = 0; queue<P> q; q.push(make_pair(fh, fw)); while (q.size()) { P p = q.front(); q.pop(); bool add = false; REP(i, 4) { P p_ = p; p_.first += dy[i]; p_.second += dx[i]; if (p_.first < 0 || h <= p_.first || p_.second < 0 || w <= p_.second) continue; if (dis[p_.first][p_.second] != -1) continue; if (a[p_.first][p_.second] == '#') { if (!add) { v.push_back(p); add = true; } continue; } int d = dis[p.first][p.second] + 1; dis[p_.first][p_.second] = d; if (d <= k) q.push(p_); } } int res = INT_MAX; for (P p : v) { res = min(res, div_up(p.first, k)); res = min(res, div_up(h - p.first - 1, k)); res = min(res, div_up(p.second, k)); res = min(res, div_up(w - p.second - 1, k)); } cout << res + 1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:56:5: error: 'memset' was not declared in this scope 56 | memset(dis, -1, sizeof(dis)); | ^~~~~~ a.cc:14:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 13 | #include <climits> +++ |+#include <cstring> 14 |