submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s545129681
p03994
C++
#include <iostream> using namespace std; int main(){ string s; cin >> s; int K; cin >> K; for(unsigned int i = 0; i < s.size(); i++){ if(s[i] == 'a') continue; if(K >= long long('z' - s[i] + 1)){ K -= long long('z' - s[i] + 1); s[i] = 'a'; } } K = K % 26; while(K > 0){ s[s.size() - 1]++; if(s[s.size() - 1] >'z') s[s.size() - 1] ='a'; K--; } cout << s; return 0; }
a.cc: In function 'int main()': a.cc:11:13: error: expected primary-expression before 'long' 11 | if(K >= long long('z' - s[i] + 1)){ | ^~~~ a.cc:11:12: error: expected ')' before 'long' 11 | if(K >= long long('z' - s[i] + 1)){ | ~ ^~~~~ | ) a.cc:12:12: error: expected primary-expression before 'long' 12 | K -= long long('z' - s[i] + 1); | ^~~~
s304556773
p03994
C++
#include <stdio.h> #include <string.h> void solve(int k, char*c); int main(){ int k; char s[100001]; fgets(s, sizeof(s), stdin); scanf_s("%d", &k); solve(k, s); return 0; } void solve(int k, char*c) { for (int i = 0; i < strlen(c); ++i) { if (c[i] != 'a' && k > 'z' - c[i]) { k -= 'z' - c[i] + 1; c[i] = 'a'; } } if (k > 0) { int t = c[strlen(c) - 1] - 'a'; t = (t + k) % 26; c[strlen(c) - 1] = (char)(t + 'a'); } printf("%s", c); }
a.cc: In function 'int main()': a.cc:8:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 8 | scanf_s("%d", &k); | ^~~~~~~ | scanf
s953568080
p03994
C++
#include <stdio.h> #include <string.h> void solve(int k, char*c); int main(){ char s[100001]; gets_s(s); int K; scanf_s("%d", &K); solve(K, s); return 0; } void solve(int k, char*c) { for (int i = 0; i < strlen(c); ++i) { if (c[i] != 'a' && k > 'z' - c[i]) { k -= 'z' - c[i] + 1; c[i] = 'a'; } } if (k > 0) { int t = c[strlen(c) - 1] - 'a'; t = (t + k) % 26; c[strlen(c) - 1] = (char)(t + 'a'); } printf("%s", c); }
a.cc: In function 'int main()': a.cc:6:9: error: 'gets_s' was not declared in this scope 6 | gets_s(s); | ^~~~~~ a.cc:8:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 8 | scanf_s("%d", &K); | ^~~~~~~ | scanf
s032361881
p03994
C++
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class Main { static InputStream is; static PrintWriter out; static String INPUT = ""; void solve() { String s = ns(); int k = ni(); char[] c = s.toCharArray(); for (int i = 0; i < c.length; ++i) { if (c[i] != 'a' && k > 'z' - c[i]) { k -= 'z' - c[i] + 1; c[i] = 'a'; } } if (k > 0) { int t = c[c.length - 1] - 'a'; t = (t + k) % 26; c[c.length - 1] = (char) (t + 'a'); } out.println(c); } public static void main(String[] args) throws Exception { long S = System.currentTimeMillis(); is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); out = new PrintWriter(System.out); new Main().solve(); out.flush(); long G = System.currentTimeMillis(); tr(G - S + "ms"); } static boolean eof() { if (lenbuf == -1) return true; int lptr = ptrbuf; while (lptr < lenbuf) if (!isSpaceChar(inbuf[lptr++])) return false; try { is.mark(1000); while (true) { int b = is.read(); if (b == -1) { is.reset(); return true; } else if (!isSpaceChar(b)) { is.reset(); return false; } } } catch (IOException e) { return true; } } private static byte[] inbuf = new byte[1024]; static int lenbuf = 0, ptrbuf = 0; private static int readByte() { if (lenbuf == -1) throw new InputMismatchException(); if (ptrbuf >= lenbuf) { ptrbuf = 0; try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); } if (lenbuf <= 0) return -1; } return inbuf[ptrbuf++]; } private static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private static int skip() { int b; while ((b = readByte()) != -1 && isSpaceChar(b)) ; return b; } static double nd() { return Double.parseDouble(ns()); } static char nc() { return (char) skip(); } private static String ns() { int b = skip(); StringBuilder sb = new StringBuilder(); while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ') sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } private static char[] ns(int n) { char[] buf = new char[n]; int b = skip(), p = 0; while (p < n && !(isSpaceChar(b))) { buf[p++] = (char) b; b = readByte(); } return n == p ? buf : Arrays.copyOf(buf, p); } static char[][] nm(int n, int m) { char[][] map = new char[n][]; for (int i = 0; i < n; i++) map[i] = ns(m); return map; } static int[] na(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = ni(); return a; } private static int ni() { int num = 0, b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } static long nl() { long num = 0; int b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } static void tr(Object... o) { if (INPUT.length() != 0) System.out.println(Arrays.deepToString(o)); } static void debug(Object... o) { System.out.println(Arrays.deepToString(o)); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.ByteArrayInputStream; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.io.IOException; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.io.InputStream; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.io.PrintWriter; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: 'import' does not name a type 5 | import java.util.Arrays; | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: 'import' does not name a type 6 | import java.util.InputMismatchException; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:8:1: error: expected unqualified-id before 'public' 8 | public class Main { | ^~~~~~
s894590973
p03994
C++
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class Main { static InputStream is; static PrintWriter out; static String INPUT = ""; void solve() { String s = ns(); int k = ni(); char[] c = s.toCharArray(); for (int i = 0; i < c.length; ++i) { if (c[i] != 'a' && k > 'z' - c[i]) { k -= 'z' - c[i] + 1; c[i] = 'a'; } } if (k > 0) { int t = c[c.length - 1] - 'a'; t = (t + k) % 26; c[c.length - 1] = (char) (t + 'a'); } out.println(c); } public static void main(String[] args) throws Exception { long S = System.currentTimeMillis(); is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); out = new PrintWriter(System.out); new Main().solve(); out.flush(); long G = System.currentTimeMillis(); tr(G - S + "ms"); } static boolean eof() { if (lenbuf == -1) return true; int lptr = ptrbuf; while (lptr < lenbuf) if (!isSpaceChar(inbuf[lptr++])) return false; try { is.mark(1000); while (true) { int b = is.read(); if (b == -1) { is.reset(); return true; } else if (!isSpaceChar(b)) { is.reset(); return false; } } } catch (IOException e) { return true; } } private static byte[] inbuf = new byte[1024]; static int lenbuf = 0, ptrbuf = 0; private static int readByte() { if (lenbuf == -1) throw new InputMismatchException(); if (ptrbuf >= lenbuf) { ptrbuf = 0; try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); } if (lenbuf <= 0) return -1; } return inbuf[ptrbuf++]; } private static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private static int skip() { int b; while ((b = readByte()) != -1 && isSpaceChar(b)) ; return b; } static double nd() { return Double.parseDouble(ns()); } static char nc() { return (char) skip(); } private static String ns() { int b = skip(); StringBuilder sb = new StringBuilder(); while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ') sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } private static char[] ns(int n) { char[] buf = new char[n]; int b = skip(), p = 0; while (p < n && !(isSpaceChar(b))) { buf[p++] = (char) b; b = readByte(); } return n == p ? buf : Arrays.copyOf(buf, p); } static char[][] nm(int n, int m) { char[][] map = new char[n][]; for (int i = 0; i < n; i++) map[i] = ns(m); return map; } static int[] na(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = ni(); return a; } private static int ni() { int num = 0, b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } static long nl() { long num = 0; int b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } static void tr(Object... o) { if (INPUT.length() != 0) System.out.println(Arrays.deepToString(o)); } static void debug(Object... o) { System.out.println(Arrays.deepToString(o)); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.ByteArrayInputStream; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.io.IOException; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.io.InputStream; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.io.PrintWriter; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: 'import' does not name a type 5 | import java.util.Arrays; | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: 'import' does not name a type 6 | import java.util.InputMismatchException; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:8:1: error: expected unqualified-id before 'public' 8 | public class Main { | ^~~~~~
s233943596
p03994
C++
#include <stdio.h> #include <string.h> void solve(int k, char*c); int main(){ int k; char s[100001]; fgets(s, sizeof(s), stdin); scanf("%d", &k); solve(K, s); return 0; } void solve(int k, char*c) { for (int i = 0; i < strlen(c); ++i) { if (c[i] != 'a' && k > 'z' - c[i]) { k -= 'z' - c[i] + 1; c[i] = 'a'; } } if (k > 0) { int t = c[strlen(c) - 1] - 'a'; t = (t + k) % 26; c[strlen(c) - 1] = (char)(t + 'a'); } printf("%s", c); }
a.cc: In function 'int main()': a.cc:9:15: error: 'K' was not declared in this scope 9 | solve(K, s); | ^
s958475097
p03994
C++
#include <stdio.h> #include <string.h> void solve(int k, char*c); int main(){ int K; char s[100001]; fgets(s, sizeof(s), stdin); scanf("%d", &k); solve(K, s); return 0; } void solve(int k, char*c) { for (int i = 0; i < strlen(c); ++i) { if (c[i] != 'a' && k > 'z' - c[i]) { k -= 'z' - c[i] + 1; c[i] = 'a'; } } if (k > 0) { int t = c[strlen(c) - 1] - 'a'; t = (t + k) % 26; c[strlen(c) - 1] = (char)(t + 'a'); } printf("%s", c); }
a.cc: In function 'int main()': a.cc:8:22: error: 'k' was not declared in this scope 8 | scanf("%d", &k); | ^
s322662717
p03994
C++
#include <stdio.h> #include <string.h> int main(){ char s[100001]; gets(s); int K; scanf("%d", &K); int sLength = strlen(s); //printf("K = %d\r\n", K); for (int i = 0; i < sLength-1; i++){ //printf("s[%d] = %c\r\n", i, s[i]); if (s[i] != 'a' && (int)('a' + 26 - s[i]) <= K){ //printf("%d <= %d is true", (int)('a' + 26 - s[i]), K); //printf("lost %d operator\r\n", 'a' + 26 - s[i]); //printf("K = %d - %d = %d\r\n", K, (int)('a' + 26 - s[i]), K - (int)('a' + 26 - s[i])); K = K - (int)('a' + 26 - s[i]); s[i] = 'a'; } else{ continue; } } //printf("actually %d operator left\r\n", K); if (s[sLength - 1] + K >'z') { s[sLength - 1] = 'a' + K - ('z' - s[sLength - 1] + 1); //printf("%d operator left\r\n", K - ('z' - s[sLength - 1] + 1)); } else s[sLength - 1] += K; printf("%s", s); return 0; }
a.cc: In function 'int main()': a.cc:5:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 5 | gets(s); | ^~~~ | getw
s024480909
p03994
C++
sl = list(input() ) k = int( input() ) al ="abcdefghijklmnopqrstuvwxyz" alen = len(al) for i in range(0,len(sl) ): p = alen - al.find(sl[i]) if(p<k): sl[i] = 'a' k = k-p #print("k,p:",k,p) if k>0 : p = alen - al.find(sl[-1]) # now position sl[-1] = al[(k-p)%26] # s = "".join(sl) print(s) #print(s,k,(alen-p),al[alen-p])
a.cc:14:2: error: invalid preprocessing directive #print 14 | #print("k,p:",k,p) | ^~~~~ a.cc:17:33: error: stray '#' in program 17 | p = alen - al.find(sl[-1]) # now position | ^ a.cc:18:38: error: stray '#' in program 18 | sl[-1] = al[(k-p)%26] # | ^ a.cc:22:2: error: invalid preprocessing directive #print 22 | #print(s,k,(alen-p),al[alen-p]) | ^~~~~ a.cc:2:1: error: 'sl' does not name a type 2 | sl = list(input() ) | ^~
s780210749
p03994
C++
import bisect import sys import math import itertools sys.setrecursionlimit(10000) INF = float('inf') # input macro def i(): return int(raw_input()) def ii(): return map(int,raw_input().split(" ")) def s(): return raw_input() def ss(): return raw_input().split(" ") def slist(): return list(raw_input()) # def join(s): return ''.join(s) #iterate macro def piter(n,m): return itertools.permutations(n,m) def citer(n,m): return itertools.combinations(n,m) #modulo macro def modc(a,b,m): c = 1 for i in xrange(b): c = c * (a - i) % m c = c * modinv(i + 1,m) % m return c def gcd(a, b): (x, lastx) = (0, 1) (y, lasty) = (1, 0) while b != 0: q = a // b (a, b) = (b, a % b) (x, lastx) = (lastx - q * x, x) (y, lasty) = (lasty - q * y, y) return (lastx, lasty, a) def modinv(a, m): (inv, q, gcd_val) = gcd(a, m) return inv % m #bisect macro def index(a, x): #Locate the leftmost value exactly equal to x i = bisect_left(a, x) if i != len(a) and a[i] == x: return i return -1 #memoize macro def memoize(f): cache = {} def helper(*args): if args not in cache: cache[(args)] = f(*args) return cache[args] return helper @memoize def nck(a,b,m): b = min([a-b,b]) if (b>a or b<0 or a<0): return 0 elif a == 0: return 1 return (nck(a-1,b-1,m)+nck(a-1,b,m)) % m nh=zip([1,0,-1,0],[0,1,0,-1]) ########### st=slist() k=i() for j in range(len(st)): o=ord(st[j]) if k >= 123-o and st[j]!='a': k -= (123-o) st[j]='a' n=97+(ord(st[len(st)-1])-97+k)%26 st[len(st)-1] = chr(n) print join(st)
a.cc:7:13: warning: multi-character character constant [-Wmultichar] 7 | INF = float('inf') | ^~~~~ a.cc:9:3: error: invalid preprocessing directive #input 9 | # input macro | ^~~~~ a.cc:23:12: error: empty character constant 23 | return ''.join(s) | ^~ a.cc:25:2: error: invalid preprocessing directive #iterate 25 | #iterate macro | ^~~~~~~ a.cc:31:2: error: invalid preprocessing directive #modulo 31 | #modulo macro | ^~~~~~ a.cc:53:2: error: invalid preprocessing directive #bisect 53 | #bisect macro | ^~~~~~ a.cc:55:6: error: invalid preprocessing directive #Locate 55 | #Locate the leftmost value exactly equal to x | ^~~~~~ a.cc:61:2: error: invalid preprocessing directive #memoize 61 | #memoize macro | ^~~~~~~ a.cc:70:1: error: stray '@' in program 70 | @memoize | ^ a.cc:81:1: error: stray '##' in program 81 | ########### | ^~ a.cc:81:3: error: stray '##' in program 81 | ########### | ^~ a.cc:81:5: error: stray '##' in program 81 | ########### | ^~ a.cc:81:7: error: stray '##' in program 81 | ########### | ^~ a.cc:81:9: error: stray '##' in program 81 | ########### | ^~ a.cc:81:11: error: stray '#' in program 81 | ########### | ^ a.cc:1:1: error: 'import' does not name a type 1 | import bisect | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:64:5: error: 'def' does not name a type 64 | def helper(*args): | ^~~
s783565215
p03994
C++
#include<bits/stdc++.h> using namespace std; #define sz(x) (int)(x).size() int main() { //freopen("d://i.txt","r",stdin); //freopen("d://o.txt","w",stdout); string s; int k,i,j,sz1,x,mov; cin>>s>>k; sz1=sz(s); fr(i,0,sz1) { if(i==sz1-1) { if(k>('z'-s[i])) { k-='z'-s[i]; k--; s[i]='a'+k; } else s[i]+=k; } else { mov='z'-s[i]+1; // cout<<mov<<endl; if(k<mov) continue; else { k-=mov; s[i]='a'; } } } cout<<s<<endl; return 0; } /* za 32 af aaa 3 aad */
a.cc: In function 'int main()': a.cc:18:4: error: 'fr' was not declared in this scope 18 | fr(i,0,sz1) | ^~
s360064551
p03994
C++
#include <cstdio> #include <cstdlib> #include <algorithm> #include <vector> #include <cstring> #include <set> #include <functional> #include <map> #include <queue> #include <cmath> #include <string> #include <stack> using namespace std; int main(void){ string str; int K,P,Kcop,i=0; char c; cin >> str >> K; Kcop=K; while(str.size()>i+1){ P=27-(str[i]-'a'); if(P==27){cout<<"a"; i++; } else if(K-P>=0){cout<<"a"; K-=P; i++; } else { cout << str[i]; i++; } } P=27-(str[i]-'a'); if(P<K)K=K-27; c=str[i]+K; cout<<c; return 0; }
a.cc: In function 'int main()': a.cc:18:1: error: 'cin' was not declared in this scope 18 | cin >> str >> K; | ^~~ a.cc:13:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 12 | #include <stack> +++ |+#include <iostream> 13 | using namespace std; a.cc:22:19: error: 'cout' was not declared in this scope 22 | if(P==27){cout<<"a"; | ^~~~ a.cc:22:19: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:25:25: error: 'cout' was not declared in this scope 25 | else if(K-P>=0){cout<<"a"; | ^~~~ a.cc:25:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:30:17: error: 'cout' was not declared in this scope 30 | cout << str[i]; | ^~~~ a.cc:30:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:37:1: error: 'cout' was not declared in this scope 37 | cout<<c; | ^~~~ a.cc:37:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s449810853
p03994
C++
#include <iostream> #include <unordered_map> #include <set> using namespace std; int main(int argc, char *argv[]) { string str("codefestival"); int K(100); for (int i = 0; i != str.size(); ++i){ int editN = 'z' - str[i] + 1; if (K - editN >= 0){ str[i] = 'a'; K -= editN; } else if (K == 0){ break; } } if (K > 0){ str[str.size()-1] + K; } cout << str < "\n"; }
a.cc: In function 'int main(int, char**)': a.cc:25:17: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and 'const char [2]') 25 | cout << str < "\n"; | ~~~~~~~~~~~ ^ ~~~~ | | | | | const char [2] | std::basic_ostream<char> In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h: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:25:19: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 25 | cout << str < "\n"; | ^~~~ /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:25:19: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 25 | cout << str < "\n"; | ^~~~ /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:25:19: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 25 | cout << str < "\n"; | ^~~~ /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:25:19: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 25 | cout << str < "\n"; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string: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:25:19: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 25 | cout << str < "\n"; | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /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:25:19: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 25 | cout << str < "\n"; | ^~~~ /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:25:19: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 25 | cout << str < "\n"; | ^~~~ /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:25:19: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'const char*' 25 | cout << str < "\n"; | ^~~~ /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:25:19: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 25 | cout << str < "\n"; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: a.cc:25:19: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 25 | cout << str < "\n"; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3901 | operator<(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed: a.cc:25:19: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>' 25 | cout << str < "\n"; | ^~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2600 | operator<(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed: a.cc:25:19: note: 'std::basic_ostream<char>' is not derived from 'const std::tuple<_UTypes ...>' 25 | cout << str < "\n"; | ^~~~ In file included from /usr/include/c++/14/set:63, from a.cc:3: /usr/include/c++/14/bits/stl_set.h:1025:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator<(const set<_Key, _Compare, _Allocator>&, const set<_Key, _Compare, _Allocator>&)' 1025 | operator<(const set<_Key, _Compare, _Alloc>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_set.h:1025:5: note: template argument deduction/substitution failed: a.cc:25:19: note: 'std::basic_ostream<char>' is not derived from 'const std::set<_Key, _Compare, _Allocator>' 25 | cout << str < "\n"; | ^~~~ In file included from /usr/include/c++/14/set:64: /usr/include/c++/14/bits/stl_multiset.h:1011:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator<(const multiset<_Key, _Compare, _Allocator>&, const multiset<_Key, _Compare, _Allocator>&)' 1011 | operator<(const multiset<_Key, _Compare, _Alloc>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_multiset.h:1011:5: note: template argument deduction/substitution failed: a.cc:25:19: note: 'std::basic_ostream<char>' is not derived from 'const std::multiset<_Key, _Compare, _Allocator>' 25 | cout << str < "\n"; | ^~~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:324:3: note: candidate: 'bool std::operator<(const error_code&, const error_code&)' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ^~~~~~~~ /usr/include/c++/14/system_error:324:31: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'const std::error_code&' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/system_error:507:3: note: candidate: 'bool std::operator<(const error_condition&, const error_condition&)' 507 | operator<(const error_condition& __lhs, | ^~~~~~~~ /usr/include/c++/14/system_error:507:36: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'const std::error_condition&' 507 | operator<(const error_condition& __lhs, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
s868706682
p03994
Java
import java.util.Scanner; import java.util.ArrayList; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int K = sc.nextInt(); System.out.println(solve(s, K)); } public static String solve(String s, int K) { char[] chars = s.toCharArray(); int lastIndex = -1; int length = chars.length; for(char i=0; i<length; i++) { char c = chars[i]; int count = ('z' - c) + 1; if(K >= count) { chars[i] = 'a'; K -= count; } else { lastIndex = i; } if(K <= 0) break; } if(K > 0 && lastIndex >= 0) { if(K > 26) K = K % 26; char c = (char)(builder.charAt(lastIndex) + K); chars[i] = c; } return String.valueOf(chars); } }
Main.java:36: error: cannot find symbol char c = (char)(builder.charAt(lastIndex) + K); ^ symbol: variable builder location: class Main Main.java:37: error: cannot find symbol chars[i] = c; ^ symbol: variable i location: class Main 2 errors
s565109296
p03994
Java
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.text.NumberFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.Map.Entry; import java.util.Scanner; public class Test3 { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader inReader = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter outWriter = new BufferedWriter(new OutputStreamWriter(System.out)); String finalOutput = ""; String line; char[] charSet = null; int count = 0; int times = 0; HashMap<Character, Integer> mMap1 = new HashMap<>(); HashMap<Integer, Character> mMap2 = new HashMap<>(); mMap1.put('a', 97); mMap1.put('b', 98); mMap1.put('c', 99); mMap1.put('d', 100); mMap1.put('e', 101); mMap1.put('f', 102); mMap1.put('g', 103); mMap1.put('h', 104); mMap1.put('i', 105); mMap1.put('j', 106); mMap1.put('k', 107); mMap1.put('l', 108); mMap1.put('m', 109); mMap1.put('n', 110); mMap1.put('o', 111); mMap1.put('p', 112); mMap1.put('q', 113); mMap1.put('r', 114); mMap1.put('s', 115); mMap1.put('t', 116); mMap1.put('u', 117); mMap1.put('v', 118); mMap1.put('w', 119); mMap1.put('x', 120); mMap1.put('y', 121); mMap1.put('z', 122); for (Entry<Character, Integer> e : mMap1.entrySet()) { mMap2.put(e.getValue(), e.getKey()); } finalOutput += " "; while ((line = inReader.readLine()) != null) { if (line.trim().compareTo("") == 0 || line == null || count == 3) break; switch (count) { case 0: // noPair = Integer.parseInt(line.trim()); charSet = line.trim().toCharArray(); break; case 1: times = Integer.parseInt(line.trim()); break; } if (count == 1) break; ++count; } for (int i = 0; i < charSet.length - 1; i++) { if (mMap1.get(charSet[i]) + times > mMap1.get('z')) { times = times - (mMap1.get('z') - mMap1.get(charSet[i]) + 1); charSet[i] = 'a'; } } if (mMap1.get(charSet[charSet.length - 1]) + times > mMap1.get('z')) { charSet[charSet.length - 1] = 'a'; } else charSet[charSet.length - 1] = mMap2.get(mMap1.get(charSet[charSet.length - 1]) + times); System.out.println(new String(charSet)); inReader.close(); outWriter.close(); } }
Main.java:12: error: class Test3 is public, should be declared in a file named Test3.java public class Test3 { ^ 1 error
s922180254
p03994
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; int main(){ string s; int k; cin>>s>>k; for(int i=0;i!=s.size()-1 && k>0;++i){ if(k<'z'-s[i]+1) continue; else{ k-='z'-s[i]+1; s[i]='a'; } } k%=26; k = k % 26; int last = s[s.length()-1] - 'a' + k; s[len-1] = 'a' + (char)(last % 26); /*if(k>'z'-s[s.size()-1]) k-=26; s[s.size()-1]=char(s[s.size()-1]+k);*/ cout<<s<<endl; }
a.cc: In function 'int main()': a.cc:21:7: error: 'len' was not declared in this scope; did you mean 'mblen'? 21 | s[len-1] = 'a' + (char)(last % 26); | ^~~ | mblen
s222830053
p03994
C++
#include<stdio.h> int a,i; char b[100010]; int main(){ scanf("%s",b); scanf("%d",&a); for(i=0;b[i]!='\0';i++){ if(a>'z'-b[i]){ a=a-('z'-b[i])-1; b[i]='a'; } } b[i-1]=(b[i-1]-'a'+k)%26+'a'; printf("%s",b); }
a.cc: In function 'int main()': a.cc:13:28: error: 'k' was not declared in this scope 13 | b[i-1]=(b[i-1]-'a'+k)%26+'a'; | ^
s234129777
p03994
C++
#include <iostream> #include <algorithm> #include <string> #include <numeric> #include <vector> using namespace std; int main() { long long k; string s; cin >> s >> k; int len = s.length(); for(int i = 0; i < len; i++){ int dif = 26 - (s[i] - 'a'); if(dif <= k){ k -= dif; s[i] = 'a'; } } k = k % 26; int last = s[len-1].compare("a"); s[len-1] = 'a' + (char)(last % 26) cout << s << endl; return 0; }
a.cc: In function 'int main()': a.cc:24:29: error: request for member 'compare' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)(len - 1)))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 24 | int last = s[len-1].compare("a"); | ^~~~~~~ a.cc:25:43: error: expected ';' before 'cout' 25 | s[len-1] = 'a' + (char)(last % 26) | ^ | ; 26 | 27 | cout << s << endl; | ~~~~
s998151921
p03994
C++
#include <iostream> #include <stdio.h> // printf,scanf #include <stdlib.h> #include <math.h> #include <string> #include <vector> #include <algorithm> //sort,binarySearch #include <functional> #include <iomanip> // setprecision #include <utility> // c+11 Array #include <set> #include <sstream> #include <bits/stdc++.h> #define PI 3.141592653589793238462643383279 #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define pb(x) push_back(x) #define debug(x) cout << #x << " = " << x << endl; #define debret(x) debug(x) ; return 0; using namespace std; int main(void){ string str; int cnt; cin >> str; cin >> cnt; REP(i,str.size()){ int t = 'z' - str[i] + 1 if(str[i] != 'a' && t <= cnt){ str[i] = 'a'; cnt -= t; } } if(cnt != 0){ char c = (str[str.size()-1] + cnt % 26); str[str.size()-1] = c; } cout << str << endl; return 0; }
a.cc: In function 'int main()': a.cc:37:9: error: expected ',' or ';' before 'if' 37 | if(str[i] != 'a' && t <= cnt){ | ^~
s714483915
p03994
C++
#include <algorithm> #include <vector> #include <cstring> #include <set> #include <functional> #include <map> #include <queue> #include <cmath> #include <string> #include <stack> using namespace std; int main(void){ string str; int K,P,Kcop,i=0; char c; cin >> str >> K; Kcop=K; while(str.size()>i){ P=27-(str[i]-'a'); if(P==27){cout<<"a"; i++; } else if(K-P>=0){cout<<"a"; K=-P; i++; } else { cout << str[i]; i++; } } P=27-(str[i]-'a'); if(P>K)K-27; c=str[i]+K; cout<<c; return 0; }
a.cc: In function 'int main()': a.cc:16:1: error: 'cin' was not declared in this scope 16 | cin >> str >> K; | ^~~ a.cc:11:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 10 | #include <stack> +++ |+#include <iostream> 11 | using namespace std; a.cc:20:19: error: 'cout' was not declared in this scope 20 | if(P==27){cout<<"a"; | ^~~~ a.cc:20:19: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:23:25: error: 'cout' was not declared in this scope 23 | else if(K-P>=0){cout<<"a"; | ^~~~ a.cc:23:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:28:17: error: 'cout' was not declared in this scope 28 | cout << str[i]; | ^~~~ a.cc:28:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:35:1: error: 'cout' was not declared in this scope 35 | cout<<c; | ^~~~ a.cc:35:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s469757551
p03994
C++
// #include <bits/stdc++.h> #include<iostream> #include<string> #include<vector> #include<algorithm> #include<functional> #include<cassert> #include<numeric> // std::accumulate(vec.begin(),vec.end(),0) sum of element #include<cmath> #include<cstdio> #include<cstdlib> #include<queue> using namespace std; typedef long long ll; typedef std::pair<int, int> pii; typedef vector<int> vi; #define rep(i,n) for(int i=0;i<n;i++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) #define rrep(i,n) for(int i=n-1;i>=0;i--) #define all(c) c.begin(),c.end() #define show(x) cout << #x << " = " << x << endl #define fi first #define se second #define pb push_back #define mk make_pair template <class X> void unique_vector(std::vector<X> &t); template <class X> void print_vector(const std::vector<X> &t); int main(){ string s; int k; cin >> s; cin >> k; rep(i, s.size()){ if(k == 0) break; int n = abs(s.at(i) - 'z') + 1; int t = k - n; // cout << abs(s.at(i)-'z')-1 << endl; // cout << t << endl; if(t < 0){ continue; }else if(t >= 0){ k -= n; s.at(i) = 'a'; } } rep2(i,s.size()){ if(s.at(i) != 'a') s.at(s.size()-1) += k%26; } cout << s << endl; } template <class X> void unique_vector(std::vector<X> &t) { std::sort(t.begin(), t.end()); t.erase( std::unique(t.begin(), t.end()), t.end() ); } template <class X> void print_vector(const std::vector<X> &t){ for(auto itr=t.begin(); itr != t.end(); itr++){ std::cout << *itr; if(itr != t.end()-1) std::cout << ' '; } std::cout << std::endl; }
a.cc: In function 'int main()': a.cc:59:8: error: 'i' was not declared in this scope 59 | rep2(i,s.size()){ | ^ a.cc:59:3: error: 'rep2' was not declared in this scope; did you mean 'rep'? 59 | rep2(i,s.size()){ | ^~~~ | rep
s915988779
p03994
C++
//CODE FESTIVAL 2016 qual A C #include <bits/stdc++.h> using namespace std; int main(){ char s[100005]; for(int i=0; i<100005; i++){ s[i] = 0; } scanf("%s", s); long long k; scanf("%lld", &k); for(int i=0; i<100005; i++){ if(s[i] != 0){ if(123-s[i] <= k){ k -= (123-s[i]); s[i] = 'a'; } } } for(int i=0; i<100005; i++){ s[i] += k; k = 0; //printf( "%d\n", int((k+s[i])%123+97)); break; } } string str = s; printf( "%s\n", str.c_str() ); //printf( "%d\n", s[0]); }
a.cc:28:22: error: 's' was not declared in this scope 28 | string str = s; | ^ a.cc:29:15: error: expected constructor, destructor, or type conversion before '(' token 29 | printf( "%s\n", str.c_str() ); | ^ a.cc:31:1: error: expected declaration before '}' token 31 | } | ^
s648330748
p03994
C
#include <stdio.h> #include <string.h> int main(void){ int i, j; int k; char s[100000]; int len; scanf("%100000s",s); scanf("%d", &k); len = strlen(s); for(i=0; i<len; i++){ if(k>= 124 - s[i]) s[i] = 'a'; k -= 124 - s[i]; } } printf("%s", s); putchar('\n'); return 0; }
main.c:21:12: error: expected declaration specifiers or '...' before string constant 21 | printf("%s", s); | ^~~~ main.c:21:18: error: unknown type name 's' 21 | printf("%s", s); | ^ main.c:22:13: error: expected declaration specifiers or '...' before '\xa' 22 | putchar('\n'); | ^~~~ main.c:23:9: error: expected identifier or '(' before 'return' 23 | return 0; | ^~~~~~ main.c:24:1: error: expected identifier or '(' before '}' token 24 | } | ^
s604216644
p03994
C
#include<iostream> #include<string> #include<math.h> using namespace std; int main(){ string s; int a[100000]; long long int k; cin >> s; cin >> k; for (int i = 0; i < s.length(); i++){ if (s[i] == 'a'){ a[i] = 1; } else if (s[i] == 'b'){ a[i] = 2; } else if (s[i] == 'c'){ a[i] = 3; } else if (s[i] == 'd'){ a[i] = 4; } else if (s[i] == 'e'){ a[i] = 5; } else if (s[i] == 'f'){ a[i] = 6; } else if (s[i] == 'g'){ a[i] = 7; } else if (s[i] == 'h'){ a[i] = 8; } else if (s[i] == 'i'){ a[i] = 9; } else if (s[i] == 'j'){ a[i] = 10; } else if (s[i] == 'k'){ a[i] = 11; } else if (s[i] == 'l'){ a[i] = 12; } else if (s[i] == 'm'){ a[i] = 13; } else if (s[i] == 'n'){ a[i] = 14; } else if (s[i] == 'o'){ a[i] = 15; } else if (s[i] == 'p'){ a[i] = 16; } else if (s[i] == 'q'){ a[i] = 17; } else if (s[i] == 'r'){ a[i] = 18; } else if (s[i] == 's'){ a[i] = 19; } else if (s[i] == 't'){ a[i] = 20; } else if (s[i] == 'u'){ a[i] = 21; } else if (s[i] == 'v'){ a[i] = 22; } else if (s[i] == 'w'){ a[i] = 23; } else if (s[i] == 'x'){ a[i] = 24; } else if (s[i] == 'y'){ a[i] = 25; } else if (s[i] == 'z'){ a[i] = 26; } } int c = 0; int n = s.length(); while (c < n){ if (27 - a[c] <= k){ k -= (27 - a[c]); a[c] = 1; } if (k>0 && c == (n - 1)){ a[c] += k; if (a[c]>26){ a[c] %= 26; if (a[c] == 0){ a[c] = 26; } } } else if(k == 0){ break; } c++; } //cout << a[0] << endl; for (int i = 0; i < s.length(); i++){ if (a[i] == 1){ s[i] = 'a'; } else if (a[i] == 2){ s[i] = 'b'; } else if (a[i] == 3){ s[i] = 'c'; } else if (a[i] == 4){ s[i] = 'd'; } else if (a[i] == 5){ s[i] = 'e'; } else if (a[i] == 6){ s[i] = 'f'; } else if (a[i] == 7){ s[i] = 'g'; } else if (a[i] == 8){ s[i] = 'h'; } else if (a[i] == 9){ s[i] = 'i'; } else if (a[i] == 10){ s[i] = 'j'; } else if (a[i] == 11){ s[i] = 'k'; } else if (a[i] == 12){ s[i] = 'l'; } else if (a[i] == 13){ s[i] = 'm'; } else if (a[i] == 14){ s[i] = 'n'; } else if (a[i] == 15){ s[i] = 'o'; } else if (a[i] == 16){ s[i] = 'p'; } else if (a[i] == 17){ s[i] = 'q'; } else if (a[i] == 18){ s[i] = 'r'; } else if (a[i] == 19){ s[i] = 's'; } else if (a[i] == 20){ s[i] = 't'; } else if (a[i] == 21){ s[i] = 'u'; } else if (a[i] == 22){ s[i] = 'v'; } else if (a[i] == 23){ s[i] = 'w'; } else if (a[i] == 24){ s[i] = 'x'; } else if (a[i] == 25){ s[i] = 'y'; } else if (a[i] == 26){ s[i] = 'z'; } } cout << s << endl; return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s079693999
p03994
C++
//C++14 (Clang 3.8.0) #include <vector> #include <list> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> #include <string> #include <cstdlib> #define rp(i,a,b) for(int (i)=(int)(a);i<(int)(b);++i) typedef long long ll; using namespace std; int main(){ ll K; int c[100001]; string s; cin>>s; cin>>K; int p=0; rp(i,0,s.size()){ int tmp=int('z')-int(s[i])+1; if(tmp<=K) {c[i]=int('a');K-=ll(tmp);} else {c[i]=int(s[i]);p=i;} } K=K%26; c[i]+=K; //if(c[s.size()-1]>122) c[s.size()-1]=c[s.size()-1]-122+97; rp(i,0,s.size()) cout<<char(c[i]); cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:43:7: error: 'i' was not declared in this scope 43 | c[i]+=K; | ^
s931497201
p03994
C++
#include<stdio.h> long long int i,a,c; char b[1000100]; int main(){ gets(b); scanf("%lld",&a); for(i=0;b[i]!=NULL;i++){ if(b[i]!='\0'){ if(a>'z'-b[i]){ a=a-('z'-b[i])-1; b[i]='a'; } } } if(a>0){ a=(b[i-1]-'a'+a)%26; b[i-1]=a+'a'; } for(i=0;b[i]!=NULL;i++){ printf("%c",b[i]); } }
a.cc: In function 'int main()': a.cc:5:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 5 | gets(b); | ^~~~ | getw a.cc:7:23: warning: NULL used in arithmetic [-Wpointer-arith] 7 | for(i=0;b[i]!=NULL;i++){ | ^~~~ a.cc:19:23: warning: NULL used in arithmetic [-Wpointer-arith] 19 | for(i=0;b[i]!=NULL;i++){ | ^~~~
s646357204
p03994
C
#include <stdio.h> void approach_a( char* c, int* remain ) { // a...z = 97...122 int distance = 'z' + 1 - *c; if( *remain >= distance ) { *c = 'a'; *remain -= distance; } } void nextalphabet( char* c, int* remain ) { while( *remain > 0 ){ if( *c == 'z' ) {*c = 'a';} else {*c++; } remain-- } } main() { char s[100000]; scanf( "%s", &s ); int K; scanf( "%d", &K ); int i; int r = K; for( i=0; s[i]!='\0'; i++ ) approach_a( &s[i], &r ); int j; for( j=i-1; j>=0 && r>0; j-- ) if( s[j]!='a' ) {s[j] += r; break;} if( r==0 ) {puts( s ); return 0;} nextalphabet( &s[i-1], &r ); puts( s ); return 0; }
main.c: In function 'nextalphabet': main.c:18:25: error: expected ';' before '}' token 18 | remain-- | ^ | ; 19 | } | ~ main.c: At top level: main.c:22:1: error: return type defaults to 'int' [-Wimplicit-int] 22 | main() { | ^~~~
s795631442
p03994
C++
#include <iostream> #include <algorithm> #include <string> using namespace std; string minimamset(string s1,string s2){ if(strcmp(s1.c_str(),s2.c_str())<0) return s1; else return s2; } string changestring(string s,int K,int nota){ //cout << "s: " << s << " K: " << K << " nota: " << nota << endl; if(nota==s.length()-1){ s[nota]+=K; if(s[nota]>122){ int a=s[nota]-122; s[nota]=96+a; } return s; }else if(s[nota]+K>122){ if(s[nota]=='a'){ return minimamset(changestring(s,K,nota+1),changestring(s,K-123+s[nota],nota+1)); }else{ K-=123-s[nota]; s[nota]='a'; return changestring(s,K,nota+1); } }else{ return changestring(s,K,nota+1); } } int main() { string s; int K; cin >> s; cin >> K; s = changestring(s,K,0); cout << s << endl; return 0; }
a.cc: In function 'std::string minimamset(std::string, std::string)': a.cc:7:8: error: 'strcmp' was not declared in this scope 7 | if(strcmp(s1.c_str(),s2.c_str())<0) return s1; | ^~~~~~ a.cc:3:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <algorithm> +++ |+#include <cstring> 3 | #include <string> a.cc:9:1: warning: control reaches end of non-void function [-Wreturn-type] 9 | } | ^
s891770499
p03994
C++
#include<bits/stdc++.h> using namespace std; #define fs first #define sc second #define MOD 1000000007 #define pb push_back #define mp make_pair typedef int Int; typedef pair<Int,Int> pii; typedef vector<Int> vi; typedef vector<pii> vii; int main() { string S; Int K,l,lt=l-1; cin>>S; cin>>K; l=S.length(); for(Int i=0;i<l;i++) { if((26-(S[i]-'a'))<=K) { K-=26-(S[i]-'a'); S[i]='a'; } else { if(K>0) (lt=i;) } } if(K!=0) { Int temp=((S[lt]-'a'+K)%26); S[lt]=temp+'a'; } cout<<S; return 0; }
a.cc: In function 'int main()': a.cc:30:30: error: expected ')' before ';' token 30 | (lt=i;) | ~ ^ | ) a.cc:30:31: error: expected primary-expression before ')' token 30 | (lt=i;) | ^
s963531703
p03994
Java
public class Main { // aにできるまで最初からステップ,あとは最後のものを最後まで回す public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder str = new StringBuilder(br.readLine()); int num = Integer.valueOf(br.readLine()); br.close(); int index = 0; int length = str.length(); while (index < length - 1) { // if(num>26*length){ // str = str.replaceAll("[a-z]", "a"); // break; // } if (num > counttoa(str.charAt(index))) { num = num - counttoa(str.charAt(index)); // str = str.substring(0, index) + "a" + str.substring(index + 1); str.setCharAt(index, 'a'); } index++; } // 最後の文字を変換 // str = str.substring(0, length - 1) + stepChr(str.charAt(length - 1), num); str.setCharAt(length-1, stepChr(str.charAt(length-1),num)); System.out.println(str); } private static char stepChr(char input, int num) { int realNum = num % 26; char result = input; for (int i = 0; i < realNum; i++) { result = nextChr(result); } return result; } private static char nextChr(char input) { if (input == 'z') { return 'a'; } else return (char) ((int) input + 1); } private static int counttoa(char input) { if (input == 'a') { return 0; } return 26 - ((int) input - (int) 'a'); } }
Main.java:5: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:5: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:5: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class Main 3 errors
s243573272
p03994
C++
#include <cstring> #include <cstdlib> #include <cmath> #include <ctime> #include <cassert> #include <string> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <functional> #include <iostream> #include <map> #include <set> #include <time.h> using namespace std; typedef pair<int,int> P; typedef pair<int,P> P1; typedef pair<P,P> P2; typedef long long ll; #define pu push #define pb push_back #define mp make_pair #define eps 1e-7 #define INF 1000000001 #define mod 1000000009 #define fi first #define sc second #define rep(i,x) for(int i=0;i<x;i++) int main() { string s; int k; cin >> s; cin >> k; int len = s.size(); for(int i = 0;i < len; i++){ if(i == (len - 1)){ char c = s[i]; int num = c; int cnt = k % 26; num = num + cnt; if(num >= 123){ num = num - 26; } c = num; s.replace(i,1,c); }else{ char c = s[i]; int num = c; if(123 - num <= k){ k = k - (123 - num); s.replace(i,1,'a'); } } if(k == 0){ break; } } return 0; }
a.cc: In function 'int main()': a.cc:48:22: error: no matching function for call to 'std::__cxx11::basic_string<char>::replace(int&, int, char&)' 48 | s.replace(i,1,c); | ~~~~~~~~~^~~~~~~ In file included from /usr/include/c++/14/string:54, from a.cc:6: /usr/include/c++/14/bits/basic_string.h:2275:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(size_type, size_type, const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (near match) 2275 | replace(size_type __pos, size_type __n1, const _CharT* __s) | ^~~~~~~ /usr/include/c++/14/bits/basic_string.h:2275:7: note: conversion of argument 3 would be ill-formed: a.cc:48:27: error: invalid conversion from 'char' to 'const char*' [-fpermissive] 48 | s.replace(i,1,c); | ^ | | | char /usr/include/c++/14/bits/basic_string.h:2413:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(const_iterator, const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 2413 | replace(const_iterator __i1, const_iterator __i2, | ^~~~~~~ /usr/include/c++/14/bits/basic_string.h:2413:9: note: candidate expects 4 arguments, 3 provided /usr/include/c++/14/bits/basic_string.h:2522:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(size_type, size_type, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 2522 | replace(size_type __pos, size_type __n, const _Tp& __svt) | ^~~~~~~ /usr/include/c++/14/bits/basic_string.h:2522:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/bits/specfun.h:43, from /usr/include/c++/14/cmath:3906, from a.cc:3: /usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::__cxx11::basic_string<char>&]': /usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = char; _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 149 | using _If_sv = enable_if_t< | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:2522:2: required by substitution of 'template<class _Tp> std::__cxx11::basic_string<char>::_If_sv<_Tp, std::__cxx11::basic_string<char>&> std::__cxx11::basic_string<char>::replace(size_type, size_type, const _Tp&) [with _Tp = char]' 2522 | replace(size_type __pos, size_type __n, const _Tp& __svt) | ^~~~~~~ a.cc:48:22: required from here 48 | s.replace(i,1,c); | ~~~~~~~~~^~~~~~~ /usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, std::__cxx11::basic_string<char>&>' 2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:2540:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(size_type, size_type, const _Tp&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 2540 | replace(size_type __pos1, size_type __n1, const _Tp& __svt, | ^~~~~~~ /usr/include/c++/14/bits/basic_string.h:2540:9: note: candidate expects 4 arguments, 3 provided /usr/include/c++/14/bits/basic_string.h:2562:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(const_iterator, const_iterator, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 2562 | replace(const_iterator __i1, const_iterator __i2, const _Tp& __svt) | ^~~~~~~ /usr/include/c++/14/bits/basic_string.h:2562:9: note: template argument deduction/substitution failed: a.cc:48:23: note: cannot convert 'i' (type 'int') to type 'std::__cxx11::basic_string<char>::const_iterator' 48 | s.replace(i,1,c); | ^ /usr/include/c++/14/bits/basic_string.h:2200:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(size_type, size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 2200 | replace(size_type __pos, size_type __n, const basic_string& __str) | ^~~~~~~ /usr/include/c++/14/bits/basic_string.h:2200:67: note: no known conversion for argument 3 from 'char' to 'const std::__cxx11::basic_string<char>&' 2200 | replace(size_type __pos, size_type __n, const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:2223:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(size_type, size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 2223 | replace(size_type __pos1, size_type __n1, const basic_string& __str, | ^~~~~~~ /usr/include/c++/14/bits/basic_string.h:2223:7: note: candidate expects 5 arguments, 3 provided /usr/include/c++/14/bits/basic_string.h:2249:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(size_type, size_type, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 2249 | replace(size_type __pos, size_type __n1, const _CharT* __s, | ^~~~~~~ /usr/include/c++/14/bits/basic_string.h:2249:7: note: candidate expects 4 arguments, 3 provided /usr/include/c++/14/bits/basic_string.h:2300:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(size_type, size_type, size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 2300 | replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) | ^~~~~~~ /usr/include/c++/14/bits/basic_string.h:2300:7: note: candidate expects 4 arguments, 3 provided /usr/include/c++/14/bits/basic_string.h:2319:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(__const_iterator, __const_iterator, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]' 2319 | replace(__const_iterator __i1, __const_iterator __i2, | ^~~~~~~ /usr/include/c++/14/bits/basic_string.h:2319:32: note: no known conversion for argument 1 from 'int' to 'std::__cxx11::basic_string<char>::__const_iterator' {aka 'std::__cxx11::basic_string<char>::const_iterator'} 2319 | replace(__const_iterator __i1, __const_iterator __i2, | ~~~~~~~~~~~~~~~~~^~~~ /usr/include/c++/14/bits/basic_string.h:2340:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(__const_iterator, __const_iterator, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; __const_iterator = std::__cxx11::basic_string<char>::const_iterator; size_type = long unsigned int]' 2340 | replace(__const_iterator __i1, __const_iterator __i2, | ^~~~~~~ /usr/include/c++/14/bits/basic_string.h:2340:7: note: candidate expects 4 arguments, 3 provided /usr/include/c++/14/bits/basic_string.h:2363:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(__const_iterator, __const_iterator, const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]' 2363 | replace(__const_iterator __i1, __const_iterator __i2, const _CharT* __s) | ^~~~~~~ /usr/include/c++/14/bits/basic_string.h:2363:32: note: no known conversion for argument 1 from 'int' to 'std::__cxx11::basic_string<char>::__const_iterator' {aka 'std::__cxx11::basic_str
s099478748
p03994
C++
#include <iostream> #include <string> using namespace std; int ps(string &s, int &k, int i) { for (int i = 0; i < s.size(); i++) { if (s[i] == 'a') continue; if (('z' + 1) - s[i] <= k) { int diff = 'z' + 1 - s[i]; s[i] = 'a'; k -= diff; return i + 1; } } s[s.size() - 1] += k; k = 0; return -1; } int main() { string s; long long K; cin >> s; cin >> K; long long i = 0; while (K) { i = ps(s, K, i); } cout << s << endl; return 0; }
a.cc: In function 'int main()': a.cc:28:15: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int' 28 | i = ps(s, K, i); | ^ a.cc:6:24: note: initializing argument 2 of 'int ps(std::string&, int&, int)' 6 | int ps(string &s, int &k, int i) { | ~~~~~^
s882759307
p03994
Java
import java.io.*; import java.util.NoSuchElementException; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String str=sc.next(); char ar[]=str.toCharArray(); int L=ar.length; int left=sc.nextInt(); for (int i = 0; i < L-1; i++) { int aaa=va((int) ar[i]); if(aaa!=26&&aaa<left){ isa=true; ar[i]='a'; left-=aaa; } } while(left>0){ if(left>=26){ left%=26; }else{ ar[L-1]+=left; left=0; if(ar[L-1]>122) ar[L-1]+=97-123; } } System.out.println(String.valueOf(ar)); } static int va(int aa){ return -aa+97+26; } }
Main.java:23: error: cannot find symbol isa=true; ^ symbol: variable isa location: class Main 1 error
s116778812
p03994
C++
#include <bits/stdc++.h> using namespace std; #define FOR(i,a,b) for (int i = (a); i < (b); i++) #define REP(i,n) FOR(i,0,n) int main() { string str; int k; cin >> str >> k; REP(i, str.size()) { if (str[i] == 'a') continue; int cnt = 'z' - str[i] + 1; if (cnt <= k) { str[i] = 'a'; k -= cnt; } } str[str.size() - 1] = (char)((str[str.size() - 1] - 'a') + (k % 26)) % 26 + 'a'); cout << str << endl; return 0; }
a.cc: In function 'int main()': a.cc:24:88: error: expected ';' before ')' token 24 | str[str.size() - 1] = (char)((str[str.size() - 1] - 'a') + (k % 26)) % 26 + 'a'); | ^ | ;
s137048486
p03994
C++
#include <iostream> #include <string> #include <algorithm> #include <functional> #include <vector> #include <stack> #include <queue> #include <set> #include <bitset> #include <map> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> using namespace std; typedef long long ll; typedef pair<int,int> pint; typedef vector<int> vint; typedef vector<pint> vpint; #define mp make_pair #define fi first #define se second #define all(v) (v).begin(),(v).end() #define rep(i,n) for(int i=0;i<(n);i++) #define reps(i,f,n) for(int i=(f);i<(n);i++) int main(void){ string s; ll k; cin >> s >> k; ll p = 0; ll nokori = k; while(nokori > 0){ // cout << s << endl; // printf("%d %d\n", nokori, p); while('z' - s[p] + 1 => nokori && p < s.size() - 1){ p++; } // printf("%d\n", p); if(p == s.size() - 1){ nokori %= 26; ll d = s[p] - 'a' + nokori; // printf("d %d\n", d); d %= 26; s[p] = 'a' + d; // s[p] = 'a' + nokori; break; } if('z' - s[p] + 1 <= nokori){ // printf("n %d\n", nokori); nokori -= 'z' - s[p] + 1; // printf("n %d\n", nokori); s[p] = 'a'; p++; } } cout << s << endl; return 0; }
a.cc: In function 'int main()': a.cc:35:39: error: expected primary-expression before '>' token 35 | while('z' - s[p] + 1 => nokori && p < s.size() - 1){ | ^
s157994720
p03994
C++
#include<iostream> #include<vector> #include<string> #define int long long using namespace std; signed main() { string a; int b; getline(cin, a); cin >> b; for (long long c = 0; c < a.length(); c++) { int d; if (a[c] == 'a')continue; int d = 26 - (a[c] - 'a'); if (d > b)continue; a[c] = 'a'; b -= d; } a[a.length() - 1] +=b; cout << a << endl; }
a.cc: In function 'int main()': a.cc:15:21: error: redeclaration of 'long long int d' 15 | int d = 26 - (a[c] - 'a'); | ^ a.cc:13:21: note: 'long long int d' previously declared here 13 | int d; | ^
s187610177
p03994
C++
#include <iostream> using namespace std; const int maxx = 100001; int main() { string s; cin>>s; long k; cin>>k; int ptr = 0; while(k>0 && ptr<s.length()) { if( s[ptr] == 'a') { ++ptr; continue; } int need = 123 - s[ptr]; if( need =< k) { k-=need; s[ptr++]='a'; continue; } ++ptr; } if( k>0 ) { k %= 26; int v = (s[s.length()-1]-97+k) %26; s[s.length()-1] = (char)(v+97); } cout<<s<<endl; return 0; }
a.cc: In function 'int main()': a.cc:20:27: error: expected primary-expression before '<' token 20 | if( need =< k) | ^
s057472096
p03994
C++
#include <iostream> #include <string> #include <vector> #include <cmath> #include <cstdlib> #include <cstdio> using namespace std; int min(int a,int b){return a<b?a:b;} int main(void){ char c; char str[100008]; int arr[100008]; int N = 0; int K; scanf("%s",str); N = strlen(str); for(int i = 0 ; i < N ; i++ ){ c = str[i]; arr[i] = ((int)(c)) - ((int)('a')); } scanf("%d",&K); for(int i = 0 ; i < N ; i++ ){ int move = arr[i] != 0 ? 26-arr[i] : 0; if( move <= K ){ arr[i] = 0; //printf("1 %d ,%d,%d\n",i,K,move); K -= move; } } if( K > 0 ){ arr[N-1] = (arr[N-1]+K)%26; } for(int i = 0 ; i < N ; i++ ) printf("%c",((char)(arr[i]+((int)'a')))); printf("\n"); return 0; }
a.cc: In function 'int main()': a.cc:19:9: error: 'strlen' was not declared in this scope 19 | N = strlen(str); | ^~~~~~ a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 6 | #include <cstdio> +++ |+#include <cstring> 7 | using namespace std;
s446137473
p03994
C++
#include<iostream> #include<cmath> #include<string.h> #include<stdio.h> #include<algorithm> using namespace std; int n; char s[1000011]; int k; int main() { int i,j; scanf("%s",s); n=strlen(s); cin>>k; for(i=0;i<n;i++) { if((int)'z'-s[i]+1<=k) { k-=(int)'z'-s[i]+1; s[i]='a'; } } //cout<<s<<" "<<k<<endl; k%=26; for(i=n-1;i>=0;i--) { if((int)'z'-s[i]<k) { assert(0); s[i]='z'; k-=(int)'z'-s[i]; } else { s[i]+=k; break; } } printf("%s\n",s); return 0; }
a.cc: In function 'int main()': a.cc:35:13: error: 'assert' was not declared in this scope 35 | assert(0); | ^~~~~~ a.cc:6:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>' 5 | #include<algorithm> +++ |+#include <cassert> 6 | using namespace std;
s193902758
p03994
C++
#include <iostream> #include <string> #include <vector> #include <cmath> #include <cstdlib> using namespace std; int min(int a,int b){return a<b?a:b;} int main(void){ char c; char str[100008]; int arr[100008]; int N = 0; int K; scanf("%s",str); N = strlen(str); for(int i = 0 ; i < N ; i++ ){ c = str[i]; arr[i] = ((int)(c)) - ((int)('a')); } scanf("%d",&K); for(int i = 0 ; i < N ; i++ ){ int move = min(arr[i],26-arr[i]); if( move <= K ){ arr[i] = 0; //printf("1 %d ,%d,%d\n",i,K,move); K -= move; }else{ int to = min(arr[i],(arr[i]+K)%26); move = (26 + to - arr[i]) % 26; arr[i] = to; K -= move; //printf("2 %d ,%d,%d\n",i,K,move); } } if( K > 0 ){ arr[N-1] = (arr[N-1]+K)%26; } for(int i = 0 ; i < N ; i++ ) printf("%c",((char)(arr[i]+((int)'a')))); printf("\n"); return 0; }
a.cc: In function 'int main()': a.cc:18:9: error: 'strlen' was not declared in this scope 18 | N = strlen(str); | ^~~~~~ a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include <cstdlib> +++ |+#include <cstring> 6 | using namespace std;
s979180124
p03994
C++
#include<iostream> #include<vector> #include<string> #include<math.h> #include<algorithm> using namespace std; #define USINT_MAX 4294967295 int main(){ int k; char a[1000000]; cin >> a; cin >> k; for (int i=0;k>0;i++) { if ('z' + 1 - a[i] <= k) { k -= ('z' + 1 - a[i]); a[i] = 'a'; } if (a[i] == 0) { for (int j = 1;; j++) { if (a[i - j] + k <= 'z') { a[i - j] += k; break; } else { k -= ('z' - a[i - j]); a[i] = 'z'; } } } cout << a << endl; return 0; }
a.cc: In function 'int main()': a.cc:26:2: error: expected '}' at end of input 26 | } | ^ a.cc:9:11: note: to match this '{' 9 | int main(){ | ^
s815318839
p03994
C++
#include "bits/stdc++.h" #define _CRT_SECURE_NO_WARNINGS #define rep(i,n) for(int i = 0;i < n;i++) #define REP(i,n,k) for(int i = n;i < k;i++) #define P(p) cout << (p) << endl; #define sP(p) cout << setprecision(15) << fixed << p << endl; #define Pi pair<int,int> #define IINF 1e9 #define LINF 1e18 #define vi vector<int> #define mp make_pair #define pb push_back using namespace std; typedef long long ll; typedef unsigned long long ull; int dx[] = { 0, 1,0,-1 }; int dy[] = { 1, 0,-1,0 }; int dx8[] = { -1,-1,-1,0,0,1,1,1 }; int dy8[] = { -1,0,1,-1,1,-1,0,1 }; unsigned long long sttoi(std::string str) { unsigned long long ret; std::stringstream ss; ss << str; ss >> ret; return ret; } ull gcd(ull a, ull b) { if (b > a)swap(a, b); if (b == 0) return a; return gcd(b, a%b); } int comb(int n, int k) { int ans = 1; for (int i = 0; i < min(k, n - k); i++) { ans *= n - i; ans /= i + 1; } return ans; } ll mod_pow(ll n, ll p, ll mod) { if (p == 0) return 1 % mod; if (p < 2) { return n % mod; } else { ll d = 2, value = (n%mod)*(n%mod) % mod; while (d * 2 < p) { d *= 2; value *= value; value %= mod; } value %= mod; return ((value%mod) * (mod_pow(n, p - d, mod) % mod)) % mod; } } bool isPrime(int n) { if (n <= 1)return false; if (n == 2)return true; if (n % 2 == 0)return false; for (int i = 3; i*i <= n; i += 2) { if (n%i == 0)return false; } return true; } void solve() { string s; cin >> s;A ll k; cin >> k; ll sum = 0; rep(i, s.length()) { sum += ('z' - s[i] + 1)%26; } if (k < sum) { rep(i, s.length()) { if (('z' - s[i] + 1) % 26 <= k) { k -= ('z' - s[i] + 1) % 26; s[i] = 'a'; } } vector<string> vs; rep(i, s.length()) { string tmp = s; tmp[i] = 'a' + ((tmp[i] - 'a' + k) % 26); vs.push_back(tmp); } sort(vs.begin(), vs.end()); P(vs[0]) } else if (k == sum) { string ans = ""; rep(i, s.length()) { ans = ans + "a"; } P(ans); } else { string ans = ""; rep(i, s.length() - 1) { ans = ans + "a"; } P(ans + (char)('a' + ((s[s.length() - 1] - 'a' + k - sum) % 26))); } } int main() { solve(); return 0; }
a.cc: In function 'void solve()': a.cc:69:18: error: 'A' was not declared in this scope 69 | cin >> s;A | ^ a.cc:71:16: error: 'k' was not declared in this scope 71 | cin >> k; | ^
s163432983
p03994
C++
#include<iostream> #include<vector> #include<string> #define int long long using namespace std; int main() { string a; int b; cin >> a >> b; for (int c = 0;c<a.length(); c++) { int d = 26 - (a[c] - 'a'); if (d > b)continue; a[c] = 'a'; b -= d; } a[a.length() - 1] += b; cout << a << endl; }
cc1plus: error: '::main' must return 'int'
s507288412
p03994
C
char addK(char c, int k){ int i; char newC; for(i=0;i<k;i++){ if(c=='z'){ newC = 'a'; } newC = char(int(c)+1); } } int main(){ int i=0; char s[100000]; char newS[100000]; int k=0; scanf("%s",s); scanf("%d",&k); int array[num]; c = s[i]; while(c!='\0') newS[i]=addK(s[i],k); i++; c = s[i]; } return 0; }
main.c: In function 'addK': main.c:8:20: error: expected expression before 'char' 8 | newC = char(int(c)+1); | ^~~~ main.c: In function 'main': main.c:18:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 18 | scanf("%s",s); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | char addK(char c, int k){ main.c:18:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 18 | scanf("%s",s); | ^~~~~ main.c:18:9: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:20:19: error: 'num' undeclared (first use in this function) 20 | int array[num]; | ^~~ main.c:20:19: note: each undeclared identifier is reported only once for each function it appears in main.c:21:9: error: 'c' undeclared (first use in this function) 21 | c = s[i]; | ^ main.c: At top level: main.c:27:9: error: expected identifier or '(' before 'return' 27 | return 0; | ^~~~~~ main.c:28:1: error: expected identifier or '(' before '}' token 28 | } | ^
s689698555
p03994
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 1e9; string s; int n; void solve(){ int target = 0; while(n>0){ while(s[target]=='a'){ if(target==s.size()-1)break; target++; } if(('z'+1)-s[target]<=n) { n -= ('z'+1)-s[target]; s[target] = 'a'; } target = min((target+1),(s.size()-1)); if(target==s.size()-1){ n = n%26; if(s[target]+n<='z')s[target]+=n; else s[target] = 'a'+ s[target] + n - 'z' - 1; } } cout << s << endl; } int main() { cin >> s; cin >> n; solve(); return 0; }
a.cc: In function 'void solve()': a.cc:20:21: error: no matching function for call to 'min(int, std::__cxx11::basic_string<char>::size_type)' 20 | target = min((target+1),(s.size()-1)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:20:21: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) 20 | target = min((target+1),(s.size()-1)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:20:21: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 20 | target = min((target+1),(s.size()-1)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
s592680137
p03994
C++
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #include <iomanip> #include <sstream> #include <bitset> #include <fstream> #include <queue> #include <math.h> #include <set> #include <stdlib.h> #include <time.h> #include <list> #define For(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) For(i,0,n) //clear memory #define CLR(a) memset((a), 0 ,sizeof(a)) #define chk(a) rep(i, a.size()) cout << a[i] << " " #define SORT(c) sort((c).begin(),(c).end()) #define ll long long #define vi(m,a) vector<int> m(a) #define vti(m,a,i) vector<vector<int>> m(a,vector<int>(i)) #define ALL(it,a) for(auto it = a.begin(); it!=a.end(); it++) #define Fe(it,a) for(auto &it : a) #define all(a) begin(a),end(a) using namespace std; typedef pair<int, int> pii; #define WARU 1000000007; int main(void) { string str; cin >> str; long long k; cin >> k; long long n = str.length(); ll nokori = k; rep(i, n) { if (str[i] == 'a') { continue;i } int tmp = 'z' - str[i]; if (nokori > tmp) { str[i] = 'a'; nokori -= (tmp + 1); } } if (nokori > 0) { str[n - 1] = 'a' + (str[n - 1] - 'a' + (nokori % 26)) % 26; } cout << str << endl; return 0; }
a.cc: In function 'int main()': a.cc:47:35: error: expected ';' before '}' token 47 | continue;i | ^ | ; 48 | } | ~
s673119310
p03994
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 1e9; string s; int n; void solve(){ int target = 0; while(n>0){ while(s[target]=='a'){ if(target==s.size()-1)break; target++; } if(('z'+1)-s[target]<=n) { n -= ('z'+1)-s[target]; s[target] = 'a'; } target = min((target+1),(s.size()-1)); if(target==s.size()-1){ n = n%26; if(s[target]+n<='z')s[target]+=n; else s[target] = 'a'+ s[target] + n - 'z' - 1; } } } int main() { cin >> s; cin >> n; solve(); return 0; }
a.cc: In function 'void solve()': a.cc:20:21: error: no matching function for call to 'min(int, std::__cxx11::basic_string<char>::size_type)' 20 | target = min((target+1),(s.size()-1)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:20:21: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) 20 | target = min((target+1),(s.size()-1)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:20:21: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 20 | target = min((target+1),(s.size()-1)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
s320766984
p03994
C++
#define len(val) static_cast<long long>(val.size()) #define rep(i, n) for(int i=0; i<(n); i++) typedef long long ll; typedef pair<int, int> P; int main() { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; int K; cin >> K; for(int i=0; i<len(s); i++){ int n = s[i]-'a'; if(K == 0) continue; if(n!=0 && 26-n <= K){ K -= (26-n); s[i] = 'a'; continue; } if(i == len(s)-1){ s[i] = (n+K)%26+'a'; } } cout << s << endl; }
a.cc:4:9: error: 'pair' does not name a type 4 | typedef pair<int, int> P; | ^~~~ a.cc: In function 'int main()': a.cc:9:5: error: 'cin' was not declared in this scope 9 | cin.tie(0); | ^~~ a.cc:10:5: error: 'ios' has not been declared 10 | ios::sync_with_stdio(false); | ^~~ a.cc:12:5: error: 'string' was not declared in this scope 12 | string s; | ^~~~~~ a.cc:13:12: error: 's' was not declared in this scope 13 | cin >> s; | ^ a.cc:28:5: error: 'cout' was not declared in this scope 28 | cout << s << endl; | ^~~~ a.cc:28:18: error: 'endl' was not declared in this scope 28 | cout << s << endl; | ^~~~
s447048156
p03994
C++
#include <iostream> #include <algorithm> #include <climits> #include <string> #include <vector> #include <cmath> using namespace std; char s[100010]; int K; char n(char c) { int i = (int)c-(int)'a'; return (char)((i+1)%26 + (int)'a'); } void rotate(int i) { s[i] = n(s[i]); } int main() { cin >> s; cin >> K; int l = strlen(s); int x = K; int i = 0; while (x > 0 && i < l) { int d = ((int)'a' - (int)s[i] + 26) % 26; if (d > x) { i++; continue; } s[i] = 'a'; x -= d; i++; } for (int j=0; j<x; j++) rotate(l-1); cout << s << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:24:11: error: 'strlen' was not declared in this scope 24 | int l = strlen(s); | ^~~~~~ a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 6 | #include <cmath> +++ |+#include <cstring> 7 | using namespace std;
s296852705
p03994
C++
#include <algorithm> #include <cstddef> #include <cstdint> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> int main() { std::string s; int k; std::cin >> s >> k; for (char &c : s) { if (k >= ('z' - c + 1)) { k -= 'z' - c + 1; c = 'a'; } } k %= 26; if (s.back() > 'z' - k) { s.back() += k - 26; } else { s.back() += k; } std::cout << s << std::endl; return 0; } #include <algorithm> #include <cstddef> #include <cstdint> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> int main() { std::string s; int k; std::cin >> s >> k; for (char &c : s) { if (k >= ('z' - c + 1)) { k -= 'z' - c + 1; c = 'a'; } } k %= 26; if (s.back() > 'z' - k) { s.back() += k - 26; } else { s.back() += k; } std::cout << s << std::endl; return 0; }
a.cc:50:5: error: redefinition of 'int main()' 50 | int main() { | ^~~~ a.cc:16:5: note: 'int main()' previously defined here 16 | int main() { | ^~~~
s074661709
p03994
C++
(64690) 3628800 (64691) 19958400 (64692) 3628800 (64693) 39916800 (64694) 39916800 (64695) 239500800 (64696) 3628800 (64697) 39916800 (64698) 39916800 (64699) 239500800 (64700) 39916800 (64701) 479001600 (64702) 479001600 (64703) 3113510400 (64704) 40320 (64705) 362880 (64706) 362880 (64707) 1814400 (64708) 362880 (64709) 3628800 (64710) 3628800 (64711) 19958400 (64712) 362880 (64713) 3628800 (64714) 3628800 (64715) 19958400 (64716) 3628800 (64717) 39916800 (64718) 39916800 (64719) 239500800 (64720) 362880 (64721) 3628800 (64722) 3628800 (64723) 19958400 (64724) 3628800 (64725) 39916800 (64726) 39916800 (64727) 239500800 (64728) 3628800 (64729) 39916800 (64730) 39916800 (64731) 239500800 (64732) 39916800 (64733) 479001600 (64734) 479001600 (64735) 3113510400 (64736) 362880 (64737) 3628800 (64738) 3628800 (64739) 19958400 (64740) 3628800 (64741) 39916800 (64742) 39916800 (64743) 239500800 (64744) 3628800 (64745) 39916800 (64746) 39916800 (64747) 239500800 (64748) 39916800 (64749) 479001600 (64750) 479001600 (64751) 3113510400 (64752) 3628800 (64753) 39916800 (64754) 39916800 (64755) 239500800 (64756) 39916800 (64757) 479001600 (64758) 479001600 (64759) 3113510400 (64760) 39916800 (64761) 479001600 (64762) 479001600 (64763) 3113510400 (64764) 479001600 (64765) 6227020800 (64766) 6227020800 (64767) 43589145600 (64768) 5040 (64769) 40320 (64770) 40320 (64771) 181440 (64772) 40320 (64773) 362880 (64774) 362880 (64775) 1814400 (64776) 40320 (64777) 362880 (64778) 362880 (64779) 1814400 (64780) 362880 (64781) 3628800 (64782) 3628800 (64783) 19958400 (64784) 40320 (64785) 362880 (64786) 362880 (64787) 1814400 (64788) 362880 (64789) 3628800 (64790) 3628800 (64791) 19958400 (64792) 362880 (64793) 3628800 (64794) 3628800 (64795) 19958400 (64796) 3628800 (64797) 39916800 (64798) 39916800 (64799) 239500800 (64800) 40320 (64801) 362880 (64802) 362880 (64803) 1814400 (64804) 362880 (64805) 3628800 (64806) 3628800 (64807) 19958400 (64808) 362880 (64809) 3628800 (64810) 3628800 (64811) 19958400 (64812) 3628800 (64813) 39916800 (64814) 39916800 (64815) 239500800 (64816) 362880 (64817) 3628800 (64818) 3628800 (64819) 19958400 (64820) 3628800 (64821) 39916800 (64822) 39916800 (64823) 239500800 (64824) 3628800 (64825) 39916800 (64826) 39916800 (64827) 239500800 (64828) 39916800 (64829) 479001600 (64830) 479001600 (64831) 3113510400 (64832) 40320 (64833) 362880 (64834) 362880 (64835) 1814400 (64836) 362880 (64837) 3628800 (64838) 3628800 (64839) 19958400 (64840) 362880 (64841) 3628800 (64842) 3628800 (64843) 19958400 (64844) 3628800 (64845) 39916800 (64846) 39916800 (64847) 239500800 (64848) 362880 (64849) 3628800 (64850) 3628800 (64851) 19958400 (64852) 3628800 (64853) 39916800 (64854) 39916800 (64855) 239500800 (64856) 3628800 (64857) 39916800 (64858) 39916800 (64859) 239500800 (64860) 39916800 (64861) 479001600 (64862) 479001600 (64863) 3113510400 (64864) 362880 (64865) 3628800 (64866) 3628800 (64867) 19958400 (64868) 3628800 (64869) 39916800 (64870) 39916800 (64871) 239500800 (64872) 3628800 (64873) 39916800 (64874) 39916800 (64875) 239500800 (64876) 39916800 (64877) 479001600 (64878) 479001600 (64879) 3113510400 (64880) 3628800 (64881) 39916800 (64882) 39916800 (64883) 239500800 (64884) 39916800 (64885) 479001600 (64886) 479001600 (64887) 3113510400 (64888) 39916800 (64889) 479001600 (64890) 479001600 (64891) 3113510400 (64892) 479001600 (64893) 6227020800 (64894) 6227020800 (64895) 43589145600 (64896) 40320 (64897) 362880 (64898) 362880 (64899) 1814400 (64900) 362880 (64901) 3628800 (64902) 3628800 (64903) 19958400 (64904) 362880 (64905) 3628800 (64906) 3628800 (64907) 19958400 (64908) 3628800 (64909) 39916800 (64910) 39916800 (64911) 239500800 (64912) 362880 (64913) 3628800 (64914) 3628800 (64915) 19958400 (64916) 3628800 (64917) 39916800 (64918) 39916800 (64919) 239500800 (64920) 3628800 (64921) 39916800 (64922) 39916800 (64923) 239500800 (64924) 39916800 (64925) 479001600 (64926) 479001600 (64927) 3113510400 (64928) 362880 (64929) 3628800 (64930) 3628800 (64931) 19958400 (64932) 3628800 (64933) 39916800 (64934) 39916800 (64935) 239500800 (64936) 3628800 (64937) 39916800 (64938) 39916800 (64939) 239500800 (64940) 39916800 (64941) 479001600 (64942) 479001600 (64943) 3113510400 (64944) 3628800 (64945) 39916800 (64946) 39916800 (64947) 239500800 (64948) 39916800 (64949) 479001600 (64950) 479001600 (64951) 3113510400 (64952) 39916800 (64953) 479001600 (64954) 479001600 (64955) 3113510400 (64956) 479001600 (64957) 6227020800 (64958) 6227020800 (64959) 43589145600 (64960) 362880 (64961) 3628800 (64962) 3628800 (64963) 19958400 (64964) 3628800 (64965) 39916800 (64966) 39916800 (64967) 239500800 (64968) 3628800 (64969) 39916800 (64970) 39916800 (64971) 239500800 (64972) 39916800 (64973) 479001600 (64974) 479001600 (64975) 3113510400 (64976) 3628800 (64977) 39916800 (64978) 39916800 (64979) 239500800 (64980) 39916800 (64981) 479001600 (64982) 479001600 (64983) 3113510400 (64984) 39916800 (64985) 479001600 (64986) 479001600 (64987) 3113510400 (64988) 479001600 (64989) 6227020800 (64990) 6227020800 (64991) 43589145600 (64992) 3628800 (64993) 39916800 (64994) 39916800 (64995) 239500800 (64996) 39916800 (64997) 479001600 (64998) 479001600 (64999) 3113510400 (65000) 39916800 (65001) 479001600 (65002) 479001600 (65003) 3113510400 (65004) 479001600 (65005) 6227020800 (65006) 6227020800 (65007) 43589145600 (65008) 39916800 (65009) 479001600 (65010) 479001600 (65011) 3113510400 (65012) 479001600 (65013) 6227020800 (65014) 6227020800 (65015) 43589145600 (65016) 479001600 (65017) 6227020800 (65018) 6227020800 (65019) 43589145600 (65020) 6227020800 (65021) 87178291200 (65022) 87178291200 (65023) 653837184000 (65024) 5040 (65025) 40320 (65026) 40320 (65027) 181440 (65028) 40320 (65029) 362880 (65030) 362880 (65031) 1814400 (65032) 40320 (65033) 362880 (65034) 362880 (65035) 1814400 (65036) 362880 (65037) 3628800 (65038) 3628800 (65039) 19958400 (65040) 40320 (65041) 362880 (65042) 362880 (65043) 1814400 (65044) 362880 (65045) 3628800 (65046) 3628800 (65047) 19958400 (65048) 362880 (65049) 3628800 (65050) 3628800 (65051) 19958400 (65052) 3628800 (65053) 39916800 (65054) 39916800 (65055) 239500800 (65056) 40320 (65057) 362880 (65058) 362880 (65059) 1814400 (65060) 362880 (65061) 3628800 (65062) 3628800 (65063) 19958400 (65064) 362880 (65065) 3628800 (65066) 3628800 (65067) 19958400 (65068) 3628800 (65069) 39916800 (65070) 39916800 (65071) 239500800 (65072) 362880 (65073) 3628800 (65074) 3628800 (65075) 19958400 (65076) 3628800 (65077) 39916800 (65078) 39916800 (65079) 239500800 (65080) 3628800 (65081) 39916800 (65082) 39916800 (65083) 239500800 (65084) 39916800 (65085) 479001600 (65086) 479001600 (65087) 3113510400 (65088) 40320 (65089) 362880 (65090) 362880 (65091) 1814400 (65092) 362880 (65093) 3628800 (65094) 3628800 (65095) 19958400 (65096) 362880 (65097) 3628800 (65098) 3628800 (65099) 19958400 (65100) 3628800 (65101) 39916800 (65102) 39916800 (65103) 239500800 (65104) 362880 (65105) 3628800 (65106) 3628800 (65107) 19958400 (65108) 3628800 (65109) 39916800 (65110) 39916800 (65111) 239500800 (65112) 3628800 (65113) 39916800 (65114) 39916800 (65115) 239500800 (65116) 39916800 (65117) 479001600 (65118) 479001600 (65119) 3113510400 (65120) 362880 (65121) 3628800 (65122) 3628800 (65123) 19958400 (65124) 3628800 (65125) 39916800 (65126) 39916800 (65127) 239500800 (65128) 3628800 (65129) 39916800 (65130) 39916800 (65131) 239500800 (65132) 39916800 (65133) 479001600 (65134) 479001600 (65135) 3113510400 (65136) 3628800 (65137) 39916800 (65138) 39916800 (65139) 239500800 (65140) 39916800 (65141) 479001600 (65142) 479001600 (65143) 3113510400 (65144) 39916800 (65145) 479001600 (65146) 479001600 (65147) 3113510400 (65148) 479001600 (65149) 6227020800 (65150) 6227020800 (65151) 43589145600 (65152) 40320 (65153) 362880 (65154) 362880 (65155) 1814400 (65156) 362880 (65157) 3628800 (65158) 3628800 (65159) 19958400 (65160) 362880 (65161) 3628800 (65162) 3628800 (65163) 19958400 (65164) 3628800 (65165) 39916800 (65166) 39916800 (65167) 239500800 (65168) 362880 (65169) 3628800 (65170) 3628800 (65171) 19958400 (65172) 3628800 (65173) 39916800 (65174) 39916800 (65175) 239500800 (65176) 3628800 (65177) 39916800 (65178) 39916800 (65179) 239500800 (65180) 39916800 (65181) 479001600 (65182) 479001600 (65183) 3113510400 (65184) 362880 (65185) 3628800 (65186) 3628800 (65187) 19958400 (65188) 3628800 (65189) 39916800 (65190) 39916800 (65191) 239500800 (65192) 3628800 (65193) 39916800 (65194) 39916800 (65195) 239500800 (65196) 39916800 (65197) 479001600 (65198) 479001600 (65199) 3113510400 (65200) 3628800 (65201) 39916800 (65202) 39916800 (65203) 239500800 (65204) 39916800 (65205) 479001600 (65206) 479001600 (65207) 3113510400 (65208) 39916800 (65209) 479001600 (65210) 479001600 (65211) 3113510400 (65212) 479001600 (65213) 6227020800 (65214) 6227020800 (65215) 43589145600 (65216) 362880 (65217) 3628800 (65218) 3628800 (65219) 19958400 (65220) 3628800 (65221) 39916800 (65222) 39916800 (65223) 239500800 (65224) 3628800 (65225) 39916800 (65226) 39916800 (65227) 239500800 (65228) 39916800 (65229) 479001600 (65230) 479001600 (65231) 3113510400 (65232) 3628800 (65233) 39916800 (65234) 39916800 (65235) 239500800 (65236) 39916800 (65237) 479001600 (65238) 479001600 (65239) 3113510400 (65240) 39916800 (65241) 479001600 (65242) 479001600 (65243) 3113510400 (65244) 479001600 (65245) 6227020800 (65246) 6227020800 (65247) 43589145600 (65248) 3628800 (65249) 39916800 (65250) 39916800 (65251) 239500800 (65252) 39916800 (65253) 479001600 (65254) 479001600 (65255) 3113510400 (65256) 39916800 (65257) 479001600 (65258) 479001600 (65259) 3113510400 (65260) 479001600 (65261) 6227020800 (65262) 6227020800 (65263) 43589145600 (65264) 39916800 (65265) 479001600 (65266) 479001600 (65267) 3113510400 (65268) 479001600 (65269) 6227020800 (65270) 6227020800 (65271) 43589145600 (65272) 479001600 (65273) 6227020800 (65274) 6227020800 (65275) 43589145600 (65276) 6227020800 (65277) 87178291200 (65278) 87178291200 (65279) 653837184000 (65280) 40320 (65281) 362880 (65282) 362880 (65283) 1814400 (65284) 362880 (65285) 3628800 (65286) 3628800 (65287) 19958400 (65288) 362880 (65289) 3628800 (65290) 3628800 (65291) 19958400 (65292) 3628800 (65293) 39916800 (65294) 39916800 (65295) 239500800 (65296) 362880 (65297) 3628800 (65298) 3628800 (65299) 19958400 (65300) 3628800 (65301) 39916800 (65302) 39916800 (65303) 239500800 (65304) 3628800 (65305) 39916800 (65306) 39916800 (65307) 239500800 (65308) 39916800 (65309) 479001600 (65310) 479001600 (65311) 3113510400 (65312) 362880 (65313) 3628800 (65314) 3628800 (65315) 19958400 (65316) 3628800 (65317) 39916800 (65318) 39916800 (65319) 239500800 (65320) 3628800 (65321) 39916800 (65322) 39916800 (65323) 239500800 (65324) 39916800 (65325) 479001600 (65326) 479001600 (65327) 3113510400 (65328) 3628800 (65329) 39916800 (65330) 39916800 (65331) 239500800 (65332) 39916800 (65333) 479001600 (65334) 479001600 (65335) 3113510400 (65336) 39916800 (65337) 479001600 (65338) 479001600 (65339) 3113510400 (65340) 479001600 (65341) 6227020800 (65342) 6227020800 (65343) 43589145600 (65344) 362880 (65345) 3628800 (65346) 3628800 (65347) 19958400 (65348) 3628800 (65349) 39916800 (65350) 39916800 (65351) 239500800 (65352) 3628800 (65353) 39916800 (65354) 39916800 (65355) 239500800 (65356) 39916800 (65357) 479001600 (65358) 479001600 (65359) 3113510400 (65360) 3628800 (65361) 39916800 (65362) 39916800 (65363) 239500800 (65364) 39916800 (65365) 479001600 (65366) 479001600 (65367) 3113510400 (65368) 39916800 (65369) 479001600 (65370) 479001600 (65371) 3113510400 (65372) 479001600 (65373) 6227020800 (65374) 6227020800 (65375) 43589145600 (65376) 3628800 (65377) 39916800 (65378) 39916800 (65379) 239500800 (65380) 39916800 (65381) 479001600 (65382) 479001600 (65383) 3113510400 (65384) 39916800 (65385) 479001600 (65386) 479001600 (65387) 3113510400 (65388) 479001600 (65389) 6227020800 (65390) 6227020800 (65391) 43589145600 (65392) 39916800 (65393) 479001600 (65394) 479001600 (65395) 3113510400 (65396) 479001600 (65397) 6227020800 (65398) 6227020800 (65399) 43589145600 (65400) 479001600 (65401) 6227020800 (65402) 6227020800 (65403) 43589145600 (65404) 6227020800 (65405) 87178291200 (65406) 87178291200 (65407) 653837184000 (65408) 362880 (65409) 3628800 (65410) 3628800 (65411) 19958400 (65412) 3628800 (65413) 39916800 (65414) 39916800 (65415) 239500800 (65416) 3628800 (65417) 39916800 (65418) 39916800 (65419) 239500800 (65420) 39916800 (65421) 479001600 (65422) 479001600 (65423) 3113510400 (65424) 3628800 (65425) 39916800 (65426) 39916800 (65427) 239500800 (65428) 39916800 (65429) 479001600 (65430) 479001600 (65431) 3113510400 (65432) 39916800 (65433) 479001600 (65434) 479001600 (65435) 3113510400 (65436) 479001600 (65437) 6227020800 (65438) 6227020800 (65439) 43589145600 (65440) 3628800 (65441) 39916800 (65442) 39916800 (65443) 239500800 (65444) 39916800 (65445) 479001600 (65446) 479001600 (65447) 3113510400 (65448) 39916800 (65449) 479001600 (65450) 479001600 (65451) 3113510400 (65452) 479001600 (65453) 6227020800 (65454) 6227020800 (65455) 43589145600 (65456) 39916800 (65457) 479001600 (65458) 479001600 (65459) 3113510400 (65460) 479001600 (65461) 6227020800 (65462) 6227020800 (65463) 43589145600 (65464) 479001600 (65465) 6227020800 (65466) 6227020800 (65467) 43589145600 (65468) 6227020800 (65469) 87178291200 (65470) 87178291200 (65471) 653837184000 (65472) 3628800 (65473) 39916800 (65474) 39916800 (65475) 239500800 (65476) 39916800 (65477) 479001600 (65478) 479001600 (65479) 3113510400 (65480) 39916800 (65481) 479001600 (65482) 479001600 (65483) 3113510400 (65484) 479001600 (65485) 6227020800 (65486) 6227020800 (65487) 43589145600 (65488) 39916800 (65489) 479001600 (65490) 479001600 (65491) 3113510400 (65492) 479001600 (65493) 6227020800 (65494) 6227020800 (65495) 43589145600 (65496) 479001600 (65497) 6227020800 (65498) 6227020800 (65499) 43589145600 (65500) 6227020800 (65501) 87178291200 (65502) 87178291200 (65503) 653837184000 (65504) 39916800 (65505) 479001600 (65506) 479001600 (65507) 3113510400 (65508) 479001600 (65509) 6227020800 (65510) 6227020800 (65511) 43589145600 (65512) 479001600 (65513) 6227020800 (65514) 6227020800 (65515) 43589145600 (65516) 6227020800 (65517) 87178291200 (65518) 87178291200 (65519) 653837184000 (65520) 479001600 (65521) 6227020800 (65522) 6227020800 (65523) 43589145600 (65524) 6227020800 (65525) 87178291200 (65526) 87178291200 (65527) 653837184000 (65528) 6227020800 (65529) 87178291200 (65530) 87178291200 (65531) 653837184000 (65532) 87178291200 (65533) 1307674368000 (65534) 1307674368000 (65535) 10461394944000 10461394944000 Funakoshis-MacBook-Pro:041 otama$ clear Funakoshis-MacBook-Pro:041 otama$ ls a.out d.cpp Funakoshis-MacBook-Pro:041 otama$ cd Funakoshis-MacBook-Pro:~ otama$ cd Code Funakoshis-MacBook-Pro:Code otama$ ls abc codeForKurume install.sh optim android codeforces kuroki test aoj contest meshi Funakoshis-MacBook-Pro:Code otama$ cd co -bash: cd: co: No such file or directory Funakoshis-MacBook-Pro:Code otama$ cd contest/ Funakoshis-MacBook-Pro:contest otama$ ls ddpc2016 Funakoshis-MacBook-Pro:contest otama$ mkdir codefes2016_A Funakoshis-MacBook-Pro:contest otama$ cd codefes2016_A/ Funakoshis-MacBook-Pro:codefes2016_A otama$ g++ a.cpp Funakoshis-MacBook-Pro:codefes2016_A otama$ g++ a.cpp a.cpp:11:2: error: expected ';' in 'for' statement specifier rep(i,4){ ^ a.cpp:4:18: note: expanded from macro 'rep' #define rep(i,n) reep(i,0,n) ^ a.cpp:3:30: note: expanded from macro 'reep' #define reep(i,n,m) for(int i<(n);i<(m);i++) ^ a.cpp:11:2: error: expected expression a.cpp:4:18: note: expanded from macro 'rep' #define rep(i,n) reep(i,0,n) ^ a.cpp:3:30: note: expanded from macro 'reep' #define reep(i,n,m) for(int i<(n);i<(m);i++) ^ a.cpp:11:2: error: expected ')' a.cpp:4:18: note: expanded from macro 'rep' #define rep(i,n) reep(i,0,n) ^ a.cpp:3:40: note: expanded from macro 'reep' #define reep(i,n,m) for(int i<(n);i<(m);i++) ^ a.cpp:11:2: note: to match this '(' a.cpp:4:18: note: expanded from macro 'rep' #define rep(i,n) reep(i,0,n) ^ a.cpp:3:24: note: expanded from macro 'reep' #define reep(i,n,m) for(int i<(n);i<(m);i++) ^ a.cpp:11:6: error: use of undeclared identifier 'i' rep(i,4){ ^ a.cpp:15:2: error: expected ';' in 'for' statement specifier rep(i,8){ ^ a.cpp:4:18: note: expanded from macro 'rep' #define rep(i,n) reep(i,0,n) ^ a.cpp:3:30: note: expanded from macro 'reep' #define reep(i,n,m) for(int i<(n);i<(m);i++) ^ a.cpp:15:2: error: expected expression a.cpp:4:18: note: expanded from macro 'rep' #define rep(i,n) reep(i,0,n) ^ a.cpp:3:30: note: expanded from macro 'reep' #define reep(i,n,m) for(int i<(n);i<(m);i++) ^ a.cpp:15:2: error: expected ')' a.cpp:4:18: note: expanded from macro 'rep' #define rep(i,n) reep(i,0,n) ^ a.cpp:3:40: note: expanded from macro 'reep' #define reep(i,n,m) for(int i<(n);i<(m);i++) ^ a.cpp:15:2: note: to match this '(' a.cpp:4:18: note: expanded from macro 'rep' #define rep(i,n) reep(i,0,n) ^ a.cpp:3:24: note: expanded from macro 'reep' #define reep(i,n,m) for(int i<(n);i<(m);i++) ^ a.cpp:15:6: error: use of undeclared identifier 'i' rep(i,8){ ^ 8 errors generated. Funakoshis-MacBook-Pro:codefes2016_A otama$ g++ a.cpp a.cpp:12:17: error: expected ';' after expression cout << str[i] ^ ; 1 error generated. Funakoshis-MacBook-Pro:codefes2016_A otama$ g++ a.cpp Funakoshis-MacBook-Pro:codefes2016_A otama$ g++ b.cpp Funakoshis-MacBook-Pro:codefes2016_A otama$ g++ b.cpp b.cpp:11:2: error: expected ';' in 'for' statement specifier rep(i,100000){ ^ b.cpp:4:18: note: expanded from macro 'rep' #define rep(i,n) reep(i,0,n) ^ b.cpp:3:30: note: expanded from macro 'reep' #define reep(i,n,m) for(int i<(n);i<(m);i++) ^ b.cpp:11:2: error: expected expression b.cpp:4:18: note: expanded from macro 'rep' #define rep(i,n) reep(i,0,n) ^ b.cpp:3:30: note: expanded from macro 'reep' #define reep(i,n,m) for(int i<(n);i<(m);i++) ^ b.cpp:11:2: error: expected ')' b.cpp:4:18: note: expanded from macro 'rep' #define rep(i,n) reep(i,0,n) ^ b.cpp:3:40: note: expanded from macro 'reep' #define reep(i,n,m) for(int i<(n);i<(m);i++) ^ b.cpp:11:2: note: to match this '(' b.cpp:4:18: note: expanded from macro 'rep' #define rep(i,n) reep(i,0,n) ^ b.cpp:3:24: note: expanded from macro 'reep' #define reep(i,n,m) for(int i<(n);i<(m);i++) ^ b.cpp:11:6: error: use of undeclared identifier 'i' rep(i,100000){ ^ b.cpp:15:9: error: use of undeclared identifier 'N' cin >> N; ^ b.cpp:17:2: error: expected ';' in 'for' statement specifier rep(i,N){ ^ b.cpp:4:18: note: expanded from macro 'rep' #define rep(i,n) reep(i,0,n) ^ b.cpp:3:30: note: expanded from macro 'reep' #define reep(i,n,m) for(int i<(n);i<(m);i++) ^ b.cpp:17:2: error: expected expression b.cpp:4:18: note: expanded from macro 'rep' #define rep(i,n) reep(i,0,n) ^ b.cpp:3:30: note: expanded from macro 'reep' #define reep(i,n,m) for(int i<(n);i<(m);i++) ^ b.cpp:17:8: error: use of undeclared identifier 'N' rep(i,N){ ^ b.cpp:17:2: error: expected ')' rep(i,N){ ^ b.cpp:4:18: note: expanded from macro 'rep' #define rep(i,n) reep(i,0,n) ^ b.cpp:3:40: note: expanded from macro 'reep' #define reep(i,n,m) for(int i<(n);i<(m);i++) ^ b.cpp:17:2: note: to match this '(' b.cpp:4:18: note: expanded from macro 'rep' #define rep(i,n) reep(i,0,n) ^ b.cpp:3:24: note: expanded from macro 'reep' #define reep(i,n,m) for(int i<(n);i<(m);i++) ^ b.cpp:17:6: error: use of undeclared identifier 'i' rep(i,N){ ^ 10 errors generated. Funakoshis-MacBook-Pro:codefes2016_A otama$ g++ b.cpp Funakoshis-MacBook-Pro:codefes2016_A otama$ g++ b.cpp Funakoshis-MacBook-Pro:codefes2016_A otama$ g++ c.cpp Funakoshis-MacBook-Pro:codefes2016_A otama$ g++ c.cpp Funakoshis-MacBook-Pro:codefes2016_A otama$ ./a.out xyz 4 aya Funakoshis-MacBook-Pro:codefes2016_A otama$
a.cc:866:36: warning: multi-character character constant [-Wmultichar] 866 | a.cpp:11:2: error: expected ';' in 'for' statement specifier | ^~~~~ a.cc:869:39: warning: multi-character character constant [-Wmultichar] 869 | a.cpp:4:18: note: expanded from macro 'rep' | ^~~~~ a.cc:872:39: warning: multi-character character constant [-Wmultichar] 872 | a.cpp:3:30: note: expanded from macro 'reep' | ^~~~~~ a.cc:876:39: warning: multi-character character constant [-Wmultichar] 876 | a.cpp:4:18: note: expanded from macro 'rep' | ^~~~~ a.cc:879:39: warning: multi-character character constant [-Wmultichar] 879 | a.cpp:3:30: note: expanded from macro 'reep' | ^~~~~~ a.cc:883:39: warning: multi-character character constant [-Wmultichar] 883 | a.cpp:4:18: note: expanded from macro 'rep' | ^~~~~ a.cc:886:39: warning: multi-character character constant [-Wmultichar] 886 | a.cpp:3:40: note: expanded from macro 'reep' | ^~~~~~ a.cc:890:39: warning: multi-character character constant [-Wmultichar] 890 | a.cpp:4:18: note: expanded from macro 'rep' | ^~~~~ a.cc:893:39: warning: multi-character character constant [-Wmultichar] 893 | a.cpp:3:24: note: expanded from macro 'reep' | ^~~~~~ a.cc:899:36: warning: multi-character character constant [-Wmultichar] 899 | a.cpp:15:2: error: expected ';' in 'for' statement specifier | ^~~~~ a.cc:902:39: warning: multi-character character constant [-Wmultichar] 902 | a.cpp:4:18: note: expanded from macro 'rep' | ^~~~~ a.cc:905:39: warning: multi-character character constant [-Wmultichar] 905 | a.cpp:3:30: note: expanded from macro 'reep' | ^~~~~~ a.cc:909:39: warning: multi-character character constant [-Wmultichar] 909 | a.cpp:4:18: note: expanded from macro 'rep' | ^~~~~ a.cc:912:39: warning: multi-character character constant [-Wmultichar] 912 | a.cpp:3:30: note: expanded from macro 'reep' | ^~~~~~ a.cc:916:39: warning: multi-character character constant [-Wmultichar] 916 | a.cpp:4:18: note: expanded from macro 'rep' | ^~~~~ a.cc:919:39: warning: multi-character character constant [-Wmultichar] 919 | a.cpp:3:40: note: expanded from macro 'reep' | ^~~~~~ a.cc:923:39: warning: multi-character character constant [-Wmultichar] 923 | a.cpp:4:18: note: expanded from macro 'rep' | ^~~~~ a.cc:926:39: warning: multi-character character constant [-Wmultichar] 926 | a.cpp:3:24: note: expanded from macro 'reep' | ^~~~~~ a.cc:942:36: warning: multi-character character constant [-Wmultichar] 942 | b.cpp:11:2: error: expected ';' in 'for' statement specifier | ^~~~~ a.cc:945:39: warning: multi-character character constant [-Wmultichar] 945 | b.cpp:4:18: note: expanded from macro 'rep' | ^~~~~ a.cc:948:39: warning: multi-character character constant [-Wmultichar] 948 | b.cpp:3:30: note: expanded from macro 'reep' | ^~~~~~ a.cc:952:39: warning: multi-character character constant [-Wmultichar] 952 | b.cpp:4:18: note: expanded from macro 'rep' | ^~~~~ a.cc:955:39: warning: multi-character character constant [-Wmultichar] 955 | b.cpp:3:30: note: expanded from macro 'reep' | ^~~~~~ a.cc:959:39: warning: multi-character character constant [-Wmultichar] 959 | b.cpp:4:18: note: expanded from macro 'rep' | ^~~~~ a.cc:962:39: warning: multi-character character constant [-Wmultichar] 962 | b.cpp:3:40: note: expanded from macro 'reep' | ^~~~~~ a.cc:966:39: warning: multi-character character constant [-Wmultichar] 966 | b.cpp:4:18: note: expanded from macro 'rep' | ^~~~~ a.cc:969:39: warning: multi-character character constant [-Wmultichar] 969 | b.cpp:3:24: note: expanded from macro 'reep' | ^~~~~~ a.cc:978:36: warning: multi-character character constant [-Wmultichar] 978 | b.cpp:17:2: error: expected ';' in 'for' statement specifier | ^~~~~ a.cc:981:39: warning: multi-character character constant [-Wmultichar] 981 | b.cpp:4:18: note: expanded from macro 'rep' | ^~~~~ a.cc:984:39: warning: multi-character character constant [-Wmultichar] 984 | b.cpp:3:30: note: expanded from macro 'reep' | ^~~~~~ a.cc:988:39: warning: multi-character character constant [-Wmultichar] 988 | b.cpp:4:18: note: expanded from macro 'rep' | ^~~~~ a.cc:991:39: warning: multi-character character constant [-Wmultichar] 991 | b.cpp:3:30: note: expanded from macro 'reep' | ^~~~~~ a.cc:1000:39: warning: multi-character character constant [-Wmultichar] 1000 | b.cpp:4:18: note: expanded from macro 'rep' | ^~~~~ a.cc:1003:39: warning: multi-character character constant [-Wmultichar] 1003 | b.cpp:3:40: note: expanded from macro 'reep' | ^~~~~~ a.cc:1007:39: warning: multi-character character constant [-Wmultichar] 1007 | b.cpp:4:18: note: expanded from macro 'rep' | ^~~~~ a.cc:1010:39: warning: multi-character character constant [-Wmultichar] 1010 | b.cpp:3:24: note: expanded from macro 'reep' | ^~~~~~ a.cc:1:2: error: expected unqualified-id before numeric constant 1 | (64690) 3628800 | ^~~~~ a.cc:1:2: error: expected ')' before numeric constant 1 | (64690) 3628800 | ~^~~~~ | )
s155593808
p03994
C++
#include <string> #include <vector> #include <map> #include <iomanip> #include <algorithm> #include <queue> #include <cmath> #include <numeric> #include <functional> #include <cstring> #include <set> using namespace std; typedef long long ll; #define MAX 1e9+7 #define rep(i,n) for(int i=0;i<n;i++) int main() { string s; cin >> s; int K; cin >> K; rep(i, s.size()) { if ('z' - s[i] < K) { K -= ((int)('z') - (int)s[i] + 1); s[i] = 'a'; } } rep(i, K) { if (s[s.size() - 1] == 'z') s[s.size() - 1] = 'a'; else s[s.size() - 1]++; } cout << s << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:19: error: 'cin' was not declared in this scope 20 | string s; cin >> s; | ^~~ a.cc:12:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 11 | #include <set> +++ |+#include <iostream> 12 | using namespace std; a.cc:34:9: error: 'cout' was not declared in this scope 34 | cout << s << endl; | ^~~~ a.cc:34:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s193442134
p03994
C++
#include<bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<vvd> vvvd; typedef pair<int, int> pii; typedef vector<pii> vpii; #define pb push_back #define mp make_pair #define snd second #define fst first #define debug printf("--%d--\n",__LINE__) #define ll long long int int main(void){ string s; int K, N; cin >> s; N = s.size(); cin >> K; for(int i=0;i<N;i++){ int d = ('a'+26-s[i])%26; if (K >= d){ s[i] = 'a'; K -= d; } } s[N-1] = 'a' + (s[N-1]-'a' + K%26)%26 cout << s << endl; return 0; }
a.cc: In function 'int main()': a.cc:33:46: error: expected ';' before 'cout' 33 | s[N-1] = 'a' + (s[N-1]-'a' + K%26)%26 | ^ | ; 34 | cout << s << endl; | ~~~~
s677212265
p03994
C++
#include<bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<vvd> vvvd; typedef pair<int, int> pii; typedef vector<pii> vpii; #define pb push_back #define mp make_pair #define snd second #define fst first #define debug printf("--%d--\n",__LINE__) #define ll long long int int main(void){ string s; int K, N; cin >> s; N = s.size(); cin >> K; for(int i=0;i<N;i++){ int d = ('a'+26-s[i])%26; if (K >= d) s[i] = 'a'; K -= d; } } s[N-1] = 'a' + (s[N-1]-'a' + K%26)%26 cout << s << endl; return 0; }
a.cc:33:9: error: 's' does not name a type 33 | s[N-1] = 'a' + (s[N-1]-'a' + K%26)%26 | ^ a.cc:37:9: error: expected unqualified-id before 'return' 37 | return 0; | ^~~~~~ a.cc:38:1: error: expected declaration before '}' token 38 | } | ^
s668823486
p03994
C++
#include <bits/stdc++.h> using namespace std; string s; int main() { ios_base::sync_with_stdio(0); cin >> s; cin >> k; for (int i=0;i<n;i++) { int v='z'-s[i]+1; if (v<=k) { s[i]='a'; k-=v; } } cout << s << "\n"; return 0; } #include <bits/stdc++.h> using namespace std; string s; int main() { ios_base::sync_with_stdio(0); cin >> s; cin >> k; for (int i=0;i<n;i++) { int v='z'-s[i]+1; if (v<=k) { s[i]='a'; k-=v; } } cout << s << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:7:12: error: 'k' was not declared in this scope 7 | cin >> k; | ^ a.cc:8:20: error: 'n' was not declared in this scope 8 | for (int i=0;i<n;i++) { | ^ a.cc: At global scope: a.cc:20:8: error: redefinition of 'std::string s' 20 | string s; | ^ a.cc:3:8: note: 'std::string s' previously declared here 3 | string s; | ^ a.cc:21:5: error: redefinition of 'int main()' 21 | int main() { | ^~~~ a.cc:4:5: note: 'int main()' previously defined here 4 | int main() { | ^~~~ a.cc: In function 'int main()': a.cc:24:12: error: 'k' was not declared in this scope 24 | cin >> k; | ^ a.cc:25:20: error: 'n' was not declared in this scope 25 | for (int i=0;i<n;i++) { | ^
s229558550
p03994
C++
#include <bits/stdc++.h> using namespace std; string s; int main() { ios_base::sync_with_stdio(0); cin >> s; cin >> k; for (int i=0;i<n;i++) { int v='z'-s[i]+1; if (v<=k) { s[i]='a'; k-=v; } } cout << s << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:7:12: error: 'k' was not declared in this scope 7 | cin >> k; | ^ a.cc:8:20: error: 'n' was not declared in this scope 8 | for (int i=0;i<n;i++) { | ^
s508914260
p03994
C++
#include<bits/stdc++.h> #define mp make_pair #define pb push_back #define F first #define S second #define SS stringstream #define sqr(x) ((x)*(x)) #define m0(x) memset(x,0,sizeof(x)) #define m1(x) memset(x,63,sizeof(x)) #define CC(x) cout << (x) << endl #define pw(x) (1ll<<(x)) #define buli(x) __builtin_popcountll(x) #define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i) #define M 1000000007 #define N 211111 #define TASK "1" using namespace std; int main(){ #ifdef home freopen(TASK".in","r",stdin); freopen(TASK".out","w",stdout); #endif ios::sync_with_stdio(false); string s; int k; cin >> s >> k; for (int i = 0; i < s.size(); i++) { if (i + 1 == s.size()) { k %= 26; s[i] = (s[i] - 'a' + k) % 26 + 'a'; } else { int to = 'z' - s[i] + 1; to % = 26; if (to <= k) { s[i] = 'a'; k -= to; } } } cout << s << endl; return 0; }
a.cc: In function 'int main()': a.cc:37:30: error: expected primary-expression before '=' token 37 | to % = 26; | ^
s209583060
p03995
C++
考察間違えてた 解説読んだ
a.cc:1:1: error: '\U00008003\U00005bdf\U00009593\U00009055\U00003048\U00003066\U0000305f' does not name a type 1 | 考察間違えてた | ^~~~~~~~~~~~~~
s460382061
p03995
C++
#include<cstdio> #include<cstring> #include<algorithm> #define maxn 100005 #define oo 0x3f3f3f3f using namespace std; struct node { int x,y,val; }tr[maxn]; int t,n,r,c; int fa[maxn],del[maxn],mn1[maxn],mn2[maxn];//del[i]指i到父节点的差值 bool cmp(node a,node b) { if(a.y!=b.y) return a.y<b.y; else return a.x<b.x; }//以y轴为第一关键字从小到大排序 int find(int a) { if(fa[a]==a) return a; int fax=find(fa[a]); del[a]+=del[fa[a]];//合并差值 return fa[a]=fax; }//找父亲 int unionn(int a,int b,int v) { int fax=find(a),fay=find(b); if(fax!=fay) { del[fax]=v+del[b]-del[a];//推导的性质 fa[fax]=fay;//合并并查集 return 1; }//不在同一个集合内 else { if(del[a]!=del[b]+v)return 0; else return 1; }//在同一个集合内 }//并查集合并 int main() { memset(mn1,oo,sizeof(mn1)); memset(mn2,oo,sizeof(mn2)); int flag=1; scanf("%d%d%d",&r,&c,&n); for(int i=1;i<=r;++i) { fa[i]=i; del[i]=0; }//初始化并查集 for(int i=1;i<=n;++i) { int x,y,z; scanf("%d%d%d",&x,&y,&z); tr[i].x=x; tr[i].y=y; tr[i].val=z; if(z<0)flag=0; } if(!flag) { printf("No\n"); continue; } if(r==1) { printf("Yes\n"); continue; }//特判行为1 sort(tr+1,tr+1+n,cmp);//初始化排序 for(int i=1;i<n;++i) { if(tr[i].y==tr[i+1].y) { if(!unionn(tr[i].x,tr[i+1].x,tr[i+1].val-tr[i].val))//顺便结合两行 flag=0;//与所得结论矛盾 } }//判断是否矛盾 if(!flag) { printf("No\n"); continue; } for(int i=1;i<=n;++i) { int fax=find(tr[i].x); mn1[fax]=min(mn1[fax],tr[i].val+del[tr[i].x]); }//求父节点行上一点的最小值 for(int i=1;i<=r;++i) { int fax=find(i); mn2[fax]=min(mn2[fax],-del[i]); }//求某一行的父节点可能的最小值 for(int i=1;i<=r;++i) { if(fa[i]==i&&mn1[i]+mn2[i]<0) { flag=0; break; } } if(!flag) printf("No\n"); else printf("Yes\n"); return 0; }
a.cc: In function 'int main()': a.cc:70:17: error: continue statement not within a loop 70 | continue; | ^~~~~~~~ a.cc:75:17: error: continue statement not within a loop 75 | continue; | ^~~~~~~~ a.cc:89:17: error: continue statement not within a loop 89 | continue; | ^~~~~~~~
s330248553
p03995
C++
#include<cstdio> #include<cstdlib> #include<iostream> #include<vector> #include<queue> #include<bitset> #include<string> #include<stack> #include<set> #include<unordered_set> #include<map> #include<unordered_map> #include<cstring> #include<complex> #include<cmath> #include<iomanip> #include<numeric> #include<algorithm> #include<list> #include<functional> #include<cassert> #define mp make_pair #define pb push_back #define X first #define Y second #define y0 y12 #define y1 y22 #define INF 2000000005 #define PI 3.141592653589793238462643383279502884 #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c)) #define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c)) #define MEM0(a) memset((a),0,sizeof(a)); #define MEM_1(a) memset((a),-1,sizeof(a)); #define ALL(a) a.begin(),a.end() #define SYNC ios_base::sync_with_stdio(false);cin.tie(0) using namespace std; typedef long long ll; typedef long double ld; typedef double db; typedef unsigned int uint; typedef unsigned long long ull; typedef pair<int, int> Pi; typedef pair<ll, ll> Pll; typedef pair<ld, ld> Pd; typedef vector<int> Vi; typedef vector<ll> Vll; typedef vector<double> Vd; typedef vector<Pi> VPi; typedef vector<Pll> VPll; typedef vector<Pd> VPd; typedef tuple<int, int, int> iii; typedef tuple<int,int,int,int> iiii; typedef tuple<ll, ll, ll> LLL; typedef vector<iii> Viii; typedef vector<LLL> VLLL; typedef complex<double> base; const int MOD = 998244353; ll POW(ll a, ll b, ll MMM = MOD) {ll ret=1; for(;b;b>>=1,a=(a*a)%MMM)if(b&1)ret=(ret*a)% MMM; return ret; } ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); } int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 }; int ddx[]={2,2,-2,-2,1,1,-1,-1},ddy[]={1,-1,1,-1,2,-2,2,-2}; int n,m,k; int x[100000],y[100000],z[100000]; VPi v[200001]; int a[200001]; bool ok=1; bool bfs(int x) { int mn0=INF,mn1=INF; queue<int> q; q.push(x); a[x]=0; while(!q.empty()) { int y=q.front(); if(y<n)mn0=min(mn0,a[y]); else mn1=min(mn1,a[y]); q.pop(); for(auto p:v[y]) { if(a[p.X]==-INF) { q.push(p.X); a[p.X]=p.Y-a[y]; } else if(a[p.X]+a[y]!=p.Y)return 0; } } return mn0+mn1>=0; } int main(){ fill(a,a+200001,-INF); scanf("%d%d%d",&n,&m,&k); fup(i,0,k-1,1) { scanf("%d%d%d",x+i,y+i,z+i); x[i]--,y[i]--; v[x[i]].pb(mp(y[i]+n,z[i])); v[y[i]+n].pb(mp(x[i],z[i])); chk[x[i]]=chk[n+y[i]]=1; } fup(i,0,n+n-1,1)if(a[i]==-INF && !bfs(i))return !printf("No"); puts("Yes"); }
a.cc: In function 'int main()': a.cc:102:17: error: 'chk' was not declared in this scope 102 | chk[x[i]]=chk[n+y[i]]=1; | ^~~
s294352030
p03995
C++
2 2 3 1 1 0 1 2 10 2 1 20
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 2 2 | ^
s978194379
p03995
C++
#include<bits/stdc++.h> #define rep(i,n) for(int i=0;i<(int)n;i++) #define all(c) (c).begin(),(c).end() #define pb push_back #define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0); using namespace std; namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};} template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";} template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";} void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);} typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9; struct uf{ vi p; vector<ll> h; vector<vi> s; uf(int n){ p.resize(n); h.resize(n); s.resize(n); rep(i, n){ p[i] = i; s[i].pb(i); } } int root(int x){ if(x < 0 || x >= n) exit(0); //????? return x == p[x] ? x : (p[x] = root(p[x])); } bool merge(int a, int b, ll b_minus_a){ if(a < 0 || b < 0 || a >= n || b >= n) exit(0); //???? int A = a, B = b; a = root(a); b = root(b); if(a == b){ return h[B] - h[A] == b_minus_a; } if(s[a].size() < s[b].size()){ swap(a, b); b_minus_a *= -1; } p[b] = a; ll d = h[A] - h[B] + b_minus_a; for(int i : s[b]){ s[a].pb(i); h[i] += d; } s[b].erase(all(s[b])); return 1; } }; bool check(const vector<vector<pi>> &es){ int n = es.size(); uf *u_ = new uf(n); uf &u = *u_; for(const auto &v : es) if(v.size() > 1){ rep(j, v.size() - 1){ pi a = v[j], b = v[j + 1]; if(!u.merge(a.first, b.first, b.second - a.second)) return 0; } } map<int,ll> mnR; for(const auto &v : es) for(const pi &p : v){ int pos = p.first, val = p.second, r = u.root(pos); ll mn = mnR.count(r) ? mnR[r] : 1e18; mnR[r] = mn = min(mn, val - u.h[pos]); } //dbg(mnR); for(const auto &v : es) for(const pi &p : v){ int pos = p.first, val = p.second, r = u.root(pos); //dbg(r, mnR[r], u.h[pos], val); if(mnR[r] + u.h[pos] < 0) return 0; } delete u_; return 1; } int main(){ cin.tie(0); cin.sync_with_stdio(0); int h, w, n; cin >> h >> w >> n; vector<vector<pi>> tate(w), yoko(h); rep(i, n){ int y, x, a; cin >> y >> x >> a; y--; x--; yoko[y].emplace_back(x, a); tate[x].emplace_back(y, a); } cout << (check(tate) && check(yoko) ? "Yes" : "No") << endl; return 0; }
a.cc: In member function 'int uf::root(int)': a.cc:29:34: error: 'n' was not declared in this scope; did you mean 'yn'? 29 | if(x < 0 || x >= n) exit(0); //????? | ^ | yn a.cc: In member function 'bool uf::merge(int, int, ll)': a.cc:33:43: error: 'n' was not declared in this scope; did you mean 'yn'? 33 | if(a < 0 || b < 0 || a >= n || b >= n) exit(0); //???? | ^ | yn
s208533942
p03995
C++
#include <bits/stdc++.h> using namespace std; class disjoint_set { public: vector<long long> rank, prt, ptl; disjoint_set (long long size) { rank.resize(size); prt.resize(size); ptl.resize(size); for (long long i = 0; i < size; i++) { prt[i] = i; rank[i] = 0; ptl[i] = 0; } } long long find (long long x) { if (x == prt[x]){ return x; } else { int r = find(prt[x]); ptl[x] += ptl[prt[x]]; return prt[x] = r; } } bool is_equiv (int x, int y) { return find(x) == find(y); } bool unite (int x, int y, long long w) { if (find(x) == find(y)) { return false; } w += ptl[x]; w -= ptl[y]; x = find(x); y = find(y); if (rank[x] < rank[y]) { swap(x, y); w *= -1; } prt[y] = x; ptl[y] = w; if (rank[x] == rank[y]) { rank[x]++; } return true; } long long diff (int x, int y) { find(x); find(y); return ptl[y] - ptl[x]; } }; void err() { cout << "No" << '\n'; exit(0); } int main() { ios::sync_with_stdio(false); cin.tie(0); int h, w, n; cin >> h >> w >> n; vector<pair<pair<int, int>, int>> cnd(n); int d = 0; for (int t = 0; t < n; t++) { int i, j, a; cin >> i >> j >> a; cnd[t] = {{--i, --j}, a}; if (i == 0 && j == 0) { d = a; } } for (auto& p : cnd) { int i = p.first.first; int j = p.first.second; long long& a = p.second; if (i > 0 && j > 0) { a += d; } else if (i == 0 && j == 0) { a = 0; } } disjoint_set djs(h + w - 1); int mina = 2e9; int maxb = -2e9; for (auto p : cnd) { int i = p.first.first; int j = p.first.second; int s = h - 1 + j; int t = h - 1 - i; long long w = p.second; if (djs.is_equiv(s, t)) { if (djs.diff(s, t) != w) { err(); } } else { djs.unite(s, t, w); for (int r = 0; r < 2; r++) { if (djs.is_equiv(h - 1, s)) { if (s < h - 1) { mina = min(mina, djs.diff(h - 1, s)); } else if (h - 1 < s) { maxb = max(maxb, djs.diff(s, h - 1)); } } swap(s, t); } } } if (maxb > 0 && mina - maxb < d) { err(); } cout << "Yes" << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:75:22: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'int' 75 | long long& a = p.second; | ~~^~~~~~ a.cc:100:23: error: no matching function for call to 'min(int&, long long int)' 100 | mina = min(mina, djs.diff(h - 1, s)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:100:23: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 100 | mina = min(mina, djs.diff(h - 1, s)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /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:100:23: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 100 | mina = min(mina, djs.diff(h - 1, s)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:102:23: error: no matching function for call to 'max(int&, long long int)' 102 | maxb = max(maxb, djs.diff(s, h - 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:102:23: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 102 | maxb = max(maxb, djs.diff(s, h - 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:102:23: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 102 | maxb = max(maxb, djs.diff(s, h - 1)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
s497665349
p03995
C++
#include <iostream> #include<vector> #include<algorithm> #include<map> using namespace std; int main() { int r,c,n;cin>>r>>c>>n; map<int,map<int,int>> m; vector<int> a(n); vector<pair<int,int>> xy(n),yx(n); vector<vector<pair<int,int>>> ya(r),xa(c); for(int i=0;i<n;i++){ cin>>xy[i].first>>xy[i].second>>a[i]; xy[i].first--; xy[i].second--; yx[i].first=xy[i].second; yx[i].second=xy[i].first; ya[xy[i].first].push_back(make_pair(xy[i].second,a[i])); xa[xy[i].second].push_back(make_pair(xy[i].first,a[i])); m[xy[i].first][xy[i].second]=a[i]; } // sort(xy.begin(),xy.end()); // sort(yx.begin(),yx.end()); for(int i=0;i<r;i++){ sort(ya[i].begin(),ya[i].end()); } for(int i=0;i<c;i++){ sort(xa[i].begin(),xa[i].end()); } for(int i=0;i<c;i++){ int min=-1; int dmax=0; map<int,int> md; for(int j=0;j<xa[i].size();j++){ int tempx=xa[i][j].first; for(int k=0;k<ya[tempx].size();k++){ if(dmax<xa[i][j].second-ya[tempx][k].second){ dmax=xa[i][j].second-ya[tempx][k].second; } map<int,int>::iterator itr=md.find[ya[tempx][k].first]; if(itr!=md.end()){ md[ya[tempx][k].first]=xa[i][j].second-ya[tempx][k].second; }else{ if(md[ya[tempx][k].first]!=xa[i][j].second-ya[tempx][k].second){ cout<<"No"<<endl; return 0; } } } } for(int j=0;j<xa[i].size();j++){ if(xa[i][j].second-dmax<0){ cout<<"No"<<endl; return 0; } } } cout<<"Yes"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:41:67: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 41 | map<int,int>::iterator itr=md.find[ya[tempx][k].first]; | ^
s609826711
p03995
C++
#include <iostream> #include<vector> #include<algorithm> #include<map> using namespace std; int main() { int r,c,n;cin>>r>>c>>n; map<int,map<int,int>> m; vector<int> a(n); vector<pair<int,int>> xy(n),yx(n); vector<vector<pair<int,int>>> ya(r),xa(c); for(int i=0;i<n;i++){ cin>>xy[i].first>>xy[i].second>>a[i]; xy[i].first--; xy[i].second--; yx[i].first=xy[i].second; yx[i].second=xy[i].first; ya[xy[i].first].push_back(make_pair(xy[i].second,a[i])); xa[xy[i].second].push_back(make_pair(xy[i].first,a[i])); m[xy[i].first][xy[i].second]=a[i]; } // sort(xy.begin(),xy.end()); // sort(yx.begin(),yx.end()); for(int i=0;i<r;i++){ sort(ya[i].begin(),ya[i].end()); } for(int i=0;i<c;i++){ sort(xa[i].begin(),xa[i].end()); } for(int i=0;i<c;i++){ int min=-1; int dmax=0; map<int,int> md; for(int j=0;j<xa[i].size();j++){ int tempx=xa[i][j].first; for(int k=0;k<ya[tempx].size();k++){ if(dmax<xa[i][j].second-ya[tempx][k].second){ dmax=xa[i][j].second-ya[tempx][k].second; } auto itr=md.find[ya[tempx][k].first]; if(itr!=md.end()){ md[ya[tempx][k].first]=xa[i][j].second-ya[tempx][k].second; }else{ if(md[ya[tempx][k].first]!=xa[i][j].second-ya[tempx][k].second){ cout<<"No"<<endl; return 0; } } } } for(int j=0;j<xa[i].size();j++){ if(xa[i][j].second-dmax<0){ cout<<"No"<<endl; return 0; } } } cout<<"Yes"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:41:49: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 41 | auto itr=md.find[ya[tempx][k].first]; | ^
s695904998
p03995
C++
#include<bits/stdc++.h> #define maxn 500005 #define inf -10000000 using namespace std; inline int read() { char x = getchar(); int lin = 0, f = 1; while(x < '0' || x > '9') { if(x == '-') f = -1; x = getchar(); } while(x >= '0' && x <= '9') { lin = lin * 10 + x - '0'; x = getchar(); } return lin * f; } #define PII pair<int,int> #define fir first #define sec second #define ma(a,b) make_pair(a,b) struct st{ int x,y,val; }s[maxn]; int hang[maxn],lie[maxn],c,r,n,t,us[maxn],fl; vector <int> h[maxn],l[maxn]; map <PII,int> poi; void dfs(int now,int fa,int ye) { us[now] = 1; int fx = s[fa].x,fy = s[fa].y,x = s[now].x,y = s[now].y; if(now != fa) { int cha = s[now].val - s[fa].val; if(x == fx) { if(lie[y] == inf) { lie[y] = lie[fy] - cha; } else if(lie[y] != lie[fy] - cha) {fl = 0; return;} } if(y == fy) { if(hang[x] == inf) { hang[x] = hang[fx] - cha; } else if(hang[x] != lie[fx] - cha) {fl = 0; return;} } } else lie[y] = hang[x] = 0; for(int i = 0; i < h[x].size(); i++) if(!us[h[x][i]]) dfs(h[x][i],now,fa); for(int i = 0; i < l[y].size(); i++) if(!us[l[y][i]]) dfs(l[y][i],now,fa); } void check(int now) { int x = s[now].x,y = s[now].y; for(int i = 0; i < h[x].size(); i++) for(int j = 0; j < l[y].size(); j++) if(s[h[x][i]].val + s[l[y][j]].val - s[now].val < 0) { fl = 0; return ; } } int main(){ t = 1 while(t--) { fl = 1; r = read(); c = read(); n = read(); for(int i = 1; i <= r; i++) { h[i].clear(); hang[i] = inf; } for(int i = 1; i <= c; i++) { l[i].clear(); lie[i] = inf; } for(int i = 1; i <= n; i++) { s[i].x = read(); s[i].y = read(); s[i].val = read(); if(s[i].val < 0) fl = 0; h[s[i].x].push_back(i); l[s[i].y].push_back(i); poi[ma(s[i].x,s[i].y)] = i; us[i] = 0; } for(int i = 1; i <= n; i++) { if(!us[i]) dfs(i,i,i); if(!fl) { break; } } for(int i = 1; i <= n; i++) check(i); if(fl) printf("Yes\n"); else printf("No\n"); } }
a.cc: In function 'int main()': a.cc:75:14: error: expected ';' before 'while' 75 | t = 1 | ^ | ; 76 | while(t--) | ~~~~~
s158493124
p03995
C++
//shu wen tong%%%%%%%%% #include<bits/stdc++.h> using namespace std; struct node{ int x,y; }a[100001]; queue<node> q; bool vis[501][501],ok; int value[501][501]; int T,R,C,n,xi,yi,data; int main(){ scanf("%d%d%d",&R,&C,&n);ok=true; memset(vis,0,sizeof(vis)); memset(value,0,sizeof(value)); while(!q.empty()) q.pop(); for(int i=1;i<=n;i++){ scanf("%d%d%d",&xi,&yi,&data); a[i].x=xi;a[i].y=yi; value[xi][yi]=data; vis[xi][yi]=true; if(data<0)ok=false; } if(!ok){ printf("No\n"); continue; } for(int i=1;i<=n;i++) q.push(a[i]); while(!q.empty()){ node now=q.front();q.pop(); for(int i=1;i<=R;i++) if(i!=now.x&&vis[i][now.y]) for(int j=1;j<=C;j++) if(j!=now.y&&vis[now.x][j]) { int D=value[i][now.y]+value[now.x][j]-value[now.x][now.y],x=i,y=j; if(D<0){ ok=false; break; } if(!vis[x][y]){ value[x][y]=D; vis[x][y]=true; n++;a[n].x=x;a[n].y=y; q.push(a[n]); } else{ if(value[x][y]!=D){ ok=false; break; } else ok=true; } } if(!ok)break; } if(ok) printf("Yes\n"); else printf("No\n"); }
a.cc: In function 'int main()': a.cc:17:49: error: reference to 'data' is ambiguous 17 | scanf("%d%d%d",&xi,&yi,&data); | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:2: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:10:19: note: 'int data' 10 | int T,R,C,n,xi,yi,data; | ^~~~ a.cc:19:39: error: reference to 'data' is ambiguous 19 | value[xi][yi]=data; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:10:19: note: 'int data' 10 | int T,R,C,n,xi,yi,data; | ^~~~ a.cc:21:28: error: reference to 'data' is ambiguous 21 | if(data<0)ok=false; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:10:19: note: 'int data' 10 | int T,R,C,n,xi,yi,data; | ^~~~ a.cc:25:25: error: continue statement not within a loop 25 | continue; | ^~~~~~~~
s661670355
p03995
C++
#include <bits/stdc++.h> # define LocalJudge( File ) freopen ( File ".in", "r", stdin ) ; using namespace std ; inline void smin ( int& d, int x ) { ( d > x ) ? d = x : 0 ; } const long long inf = ( ~0ull >> 1 ) ; const int N = 500010 ; long long a [N] ; int q [N] ; bool inq [N] ; vector < pair < int, int > > g [N] ; int main ( ) { int h, w, cnt ; scanf ( "%d %d", & h, & w ) ; scanf ( "%d", & cnt ) ; for ( int i = 0 ; i < h + w ; ++ i ) g [i].clear ( ) ; memset ( inq, 0, sizeof ( bool ) * ( h + w ) ) ; for ( int i = 0 ; i < cnt ; ++ i ) { int x, y, z ; scanf ( "%d %d %d", & x, & y, & z ) ; -- x, -- y ; g [x].push_back ( make_pair ( h + y, z ) ) ; g [h + y].push_back ( make_pair ( x, z ) ) ; } for ( int i = 0, l = h + w ; i < l ; ++ i ) { if ( inq [i] ) { continue ; } int b = 0, e = 1 ; q [0] = i ; inq [i] = true ; a [i] = 0 ; while ( b < e ) { for ( int j = 0, l = ( int ) g [q [b]].size ( ) ; j < l ; ++ j ) { int u = g [q [b]] [j].first ; int v = g [q [b]] [j].second ; if ( inq [u] ) { if ( a [q [b]] + a [u] != v ) { puts ( "No" ) ; goto h ; } continue ; } q [e] = u ; a [u] = v - a [q [b]] ; inq [u] = true ; ++ e ; } ++ b ; } long long m1 = inf, m2 = inf ; for ( int j = 0 ; j < e ; ++ j ) { if ( q [j] < h ) { smin ( m1, a [q [j]] ) ; } else { smin ( m2, a [q [j]] ) ; } } if ( m1 + m2 < 0 ) { puts ( "No" ) ; goto h ; } } puts ( "Yes" ) ; h : ; }
a.cc: In function 'int main()': a.cc:59:40: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int' 59 | smin ( m1, a [q [j]] ) ; | ^~ a.cc:7:25: note: initializing argument 1 of 'void smin(int&, int)' 7 | inline void smin ( int& d, int x ) { ( d > x ) ? d = x : 0 ; } | ~~~~~^ a.cc:61:40: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int' 61 | smin ( m2, a [q [j]] ) ; | ^~ a.cc:7:25: note: initializing argument 1 of 'void smin(int&, int)' 7 | inline void smin ( int& d, int x ) { ( d > x ) ? d = x : 0 ; } | ~~~~~^
s337809101
p03995
C++
#include <cstdio> #include <map> #include <set> using namespace std; typedef pair<int,int> P; typedef pair<P,int> PP; int comp(const PP& a, const PP& b) { return a.first < b.first; } int R,C; int N; PP rc[100010]; map<int,int> rConstraints; map<int,int> cConstraints; int main() { scanf("%d%d%d", &R, &C, &N); for(int i=0;i<N;++i) { int x,y,z; scanf("%d%d%d", &x, &y, &z);--x;--y; rc[i]=PP(P(x,y),z); } rc[N]=PP(P(200000,200000),0); /*for(int i=0;i<N+1;++i) { printf("(%d,%d)", rc[i].first.first, rc[i].first.second); }*/ sort(rc, rc+N, comp); bool OK=true; for(int i=0;i<N;++i) { P currentPos=rc[i].first; P right = P(currentPos.first,currentPos.second+1); PP found=*lower_bound(rc,rc+N,PP(right,0),comp); if (found.first == right) { int tc = currentPos.second; int tv = (found.second - rc[i].second); auto it=cConstraints.find(tc); if (it!=cConstraints.end() && cConstraints[tc]!=tv) { OK=false; } else { cConstraints.insert(make_pair(tc,tv)); } } currentPos=rc[i].first; right = P(currentPos.first+1,currentPos.second); found=*lower_bound(rc,rc+N,PP(right,0),comp); if (found.first == right) { int tc = currentPos.first; int tv = (found.second - rc[i].second); auto it=rConstraints.find(tc); if (it!=rConstraints.end() && rConstraints[tc]!=tv) { OK=false; } else { rConstraints.insert(make_pair(tc,tv)); } } } for(int i=0;i<N;++i) { P& currentPos=rc[i].first; if(rConstraints.find(currentPos.first)!=rConstraints.end()) { int v=rConstraints[currentPos.first]; int nv = rc[i].second + v; if (nv <0) { OK = false; } } if(rConstraints.find(currentPos.first-1)!=rConstraints.end()) { int v=rConstraints[currentPos.first-1]; int nv = rc[i].second - v; if (nv <0) { OK = false; } } if(cConstraints.find(currentPos.second)!=cConstraints.end()) { int v=cConstraints[currentPos.second]; int nv = rc[i].second + v; if (nv <0) { OK = false; } } if(cConstraints.find(currentPos.second-1)!=cConstraints.end()) { int v=cConstraints[currentPos.second-1]; int nv = rc[i].second - v; if (nv <0) { OK = false; } } } if (OK) { printf("Yes\n"); } else { printf("No\n"); } return 0; }
a.cc: In function 'int main()': a.cc:30:3: error: 'sort' was not declared in this scope; did you mean 'short'? 30 | sort(rc, rc+N, comp); | ^~~~ | short a.cc:35:26: error: no matching function for call to 'lower_bound(PP [100010], PP*, PP, int (&)(const PP&, const PP&))' 35 | PP found=*lower_bound(rc,rc+N,PP(right,0),comp); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_tree.h:63, from /usr/include/c++/14/map:62, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)' 1530 | lower_bound(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate expects 3 arguments, 4 provided a.cc:48:23: error: no matching function for call to 'lower_bound(PP [100010], PP*, PP, int (&)(const PP&, const PP&))' 48 | found=*lower_bound(rc,rc+N,PP(right,0),comp); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)' 1530 | lower_bound(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate expects 3 arguments, 4 provided
s066634211
p03995
C++
#include <cstdio> #include <map> #include <set> using namespace std; typedef pair<int,int> P; typedef pair<P,int> PP; int comp(const PP& a, const PP& b) { return a.first < b.first; } int R,C; int N; PP rc[100010]; map<int,int> rConstraints; map<int,int> cConstraints; int main() { scanf("%d%d%d", &R, &C, &N); for(int i=0;i<N;++i) { int x,y,z; scanf("%d%d%d", &x, &y, &z);--x;--y; rc[i]=PP(P(x,y),z); } rc[N]=PP(P(200000,200000),0); /*for(int i=0;i<N+1;++i) { printf("(%d,%d)", rc[i].first.first, rc[i].first.second); }*/ sort(rc, rc+N, comp); bool OK=true; for(int i=0;i<N;++i) { P currentPos=rc[i].first; P right = P(currentPos.first,currentPos.second+1); PP found=*lower_bound(rc,rc+N,PP(right,0),comp); if (found.first == right) { int tc = currentPos.second; int tv = (found.second - rc[i].second); auto it=cConstraints.find(tc); if (it!=cConstraints.end() && cConstraints[tc]!=tv) { OK=false; } else { cConstraints.insert(make_pair(tc,tv)); } } currentPos=rc[i].first; right = P(currentPos.first+1,currentPos.second); found=*lower_bound(rc,rc+N,PP(right,0),comp); if (found.first == right) { int tc = currentPos.first; int tv = (found.second - rc[i].second); auto it=rConstraints.find(tc); if (it!=rConstraints.end() && rConstraints[tc]!=tv) { OK=false; } else { rConstraints.insert(make_pair(tc,tv)); } } } for(int i=0;i<N;++i) { P& currentPos=rc[i].first; if(rConstraints.find(currentPos.first)!=rConstraints.end()) { int v=rConstraints[currentPos.first]; int nv = rc[i].second + v; if (nv <0) { OK = false; } } if(rConstraints.find(currentPos.first-1)!=rConstraints.end()) { int v=rConstraints[currentPos.first-1]; int nv = rc[i].second - v; if (nv <0) { OK = false; } } if(cConstraints.find(currentPos.second)!=rConstraints.end()) { int v=cConstraints[currentPos.second]; int nv = rc[i].second + v; if (nv <0) { OK = false; } } if(cConstraints.find(currentPos.second-1)!=rConstraints.end()) { int v=cConstraints[currentPos.second-1]; int nv = rc[i].second - v; if (nv <0) { OK = false; } } } if (OK) { printf("Yes\n"); } else { printf("No\n"); } return 0; }
a.cc: In function 'int main()': a.cc:30:3: error: 'sort' was not declared in this scope; did you mean 'short'? 30 | sort(rc, rc+N, comp); | ^~~~ | short a.cc:35:26: error: no matching function for call to 'lower_bound(PP [100010], PP*, PP, int (&)(const PP&, const PP&))' 35 | PP found=*lower_bound(rc,rc+N,PP(right,0),comp); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_tree.h:63, from /usr/include/c++/14/map:62, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)' 1530 | lower_bound(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate expects 3 arguments, 4 provided a.cc:48:23: error: no matching function for call to 'lower_bound(PP [100010], PP*, PP, int (&)(const PP&, const PP&))' 48 | found=*lower_bound(rc,rc+N,PP(right,0),comp); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)' 1530 | lower_bound(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate expects 3 arguments, 4 provided
s658758432
p03995
C++
#include <bits/stdc++.h> using namespace std; const int INF = 1145141919; using P = pair<int, int>; int main() { cin.tie(0); ios::sync_with_stdio(false); int R, C, N; cin >> R >> C >> N; map<P, int> memo; priority_queue<P, vector<P>, greater<P> > q; for (int i = 0; i < N; i++) { int r, c, a; cin >> r >> c >> a; r--; c--; P pos(r, c); q.push(pos); memo[pos] = a; } bool ans = true; vector<int> diff(R, INF); while (!q.empty()) { P pos = q.front(); q.pop(); int r = pos.first, c = pos.second; P b(r + 1, c); if (memo.find(b) == memo.end()) { if (diff[r] != INF) { if (memo[pos] - diff[r] < 0) { ans = false; break; } else { q.push(b); memo[b] = memo[pos] - diff[r]; } } } else { int d = memo[pos] - memo[b]; if (diff[pos.first] == INF) { diff[pos.first] = d; } else { ans = false; break; } } P u(r - 1, c); if (memo.find(u) == memo.end()) { if (r > 0 && diff[r - 1] != INF) { if (memo[pos] + diff[r - 1] < 0) { ans = false; break; } else { q.push(u); memo[u] = memo[pos] + diff[r - 1]; } } } } cout << (ans ? "Yes" : "No") << endl; return 0; }
a.cc: In function 'int main()': a.cc:28:27: error: 'class std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >' has no member named 'front' 28 | P pos = q.front(); | ^~~~~
s715016252
p03995
C++
#pragma region include #include <iostream> #include <iomanip> #include <stdio.h> #include <sstream> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <cstring> #include <vector> #include <tuple> #include <bitset> #include <queue> #include <complex> #include <set> #include <map> #include <stack> #include <list> #include <fstream> #include <random> //#include <time.h> #include <ctime> #pragma endregion //#include ///////// #define REP(i, x, n) for(int i = x; i < n; ++i) #define rep(i,n) REP(i,0,n) #define ALL(X) X.begin(), X.end() ///////// #pragma region typedef typedef long long LL; typedef long double LD; typedef unsigned long long ULL; typedef std::pair<LL,LL> PLL;// typedef std::pair<int,int> PII;// #pragma endregion //typedef ////定数 const int INF = (int)1e9; const LL MOD = (LL)1e9+7; const LL LINF = (LL)1e18+20; const double PI = acos(-1.0); const double EPS = 1e-9; ///////// using namespace::std; /* thx http://kurenaif.hatenablog.com/entry/2016/09/26/000341 */ vector< vector< edge_base > > gra; vector<LL> weight; int R,C; bool dfs(int node,LL& Xmin,LL& Ymin){ /*頂点:nodeの重みを決めてからここにくる。*/ if( node < R ){//Xの頂点,最小値の更新 Xmin = min( Xmin, weight[node] ); }else{//Yの頂点,最小値の更新 Ymin = min( Ymin, weight[node] ); } int size = gra[node].size(); for(int i=0;i<size;++i){ int to = gra[node][i].to; LL val = gra[node][i].cost;//辺の容量的なやつ if( weight[to] == LINF ){//頂点の重みが決まってない //片方が決まっているなら分ける。 weight[to] = val - weight[node]; if( dfs(to,Xmin,Ymin) == false ){ return false; } }else{ /*ある辺の2頂点の重みが両方決まっているなら 辺の容量と一致しているか調べる。 */ if( weight[to] + weight[node] != val ){ return false; } } } return true; } void solve(){ int N; cin >> R >> C >> N; weight.resize(R+C,LINF); gra.resize(R+C); for(int i=0;i<N;++i){ int r,c,a; cin >> r >> c >> a; --r;--c; gra[r].push_back( make_edge_base(R+c,a) ); gra[R+c].push_back( make_edge_base(r,a) ); } bool res = true; LL Xmin,Ymin; for(int i=0;i<R+C;++i){//各頂点についてループ //頂点の重みが決まっていない && //繋がっている頂点がある(:=制約がある) /*連結成分毎に調べている。*/ if( weight[i] == LINF && gra[i].size() > 0 ){ Xmin = Ymin = LINF;//dfs内部で値を変更している。 weight[i] = 0;//重みを仮定して調べる。 //評価順に注意dfs->Xmin,Ymin if( dfs(i,Xmin,Ymin) == false || Xmin+Ymin < 0 ){ cout << "No" << endl; return; } } } cout << "Yes" << endl; } #pragma region main signed main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;//小数を10進数表示 cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別 solve(); } #pragma endregion //main() /* 解説pdf https://goo.gl/fmi59I * N個の(r_k,c_k,a_k)は入力として与えられる。 *左辺に(i,*),右辺に(i+1,*) *全ての行で、列(j)の値からから列(j+1)の値の差は等しい。 *列(j+1)-列(j)の値をdiff(j+1)とする、また diff(1) = 列(1)//?とりま累積和にする。 とすると、 列(J) = Σ[j=1,J]diff(j) = y_(J) となる。 *同様に 条件3の式を変形すると b_(i+1,j) - b_(i,j) = b_(i+1,j+1) - b_(i,j+1) となり 全ての列で、行(i)の値からから行(i+1)の値の差は等しい。 行(i+1)-行(i)の値をdiff(i+1)とする、また diff(1) = 行(1)// とすると、 行(R) = Σ[r=1,R]diff(r) = x_(R) となる。 */
a.cc:54:17: error: 'edge_base' was not declared in this scope 54 | vector< vector< edge_base > > gra; | ^~~~~~~~~ a.cc:54:27: error: template argument 1 is invalid 54 | vector< vector< edge_base > > gra; | ^ a.cc:54:27: error: template argument 2 is invalid a.cc:54:29: error: template argument 1 is invalid 54 | vector< vector< edge_base > > gra; | ^ a.cc:54:29: error: template argument 2 is invalid a.cc: In function 'bool dfs(int, LL&, LL&)': a.cc:65:23: error: invalid types 'int[int]' for array subscript 65 | int size = gra[node].size(); | ^ a.cc:67:29: error: invalid types 'int[int]' for array subscript 67 | int to = gra[node][i].to; | ^ a.cc:68:29: error: invalid types 'int[int]' for array subscript 68 | LL val = gra[node][i].cost;//辺の容量的なやつ | ^ a.cc: In function 'void solve()': a.cc:91:13: error: request for member 'resize' in 'gra', which is of non-class type 'int' 91 | gra.resize(R+C); | ^~~~~~ a.cc:97:20: error: invalid types 'int[int]' for array subscript 97 | gra[r].push_back( make_edge_base(R+c,a) ); | ^ a.cc:97:35: error: 'make_edge_base' was not declared in this scope 97 | gra[r].push_back( make_edge_base(R+c,a) ); | ^~~~~~~~~~~~~~ a.cc:98:20: error: invalid types 'int[int]' for array subscript 98 | gra[R+c].push_back( make_edge_base(r,a) ); | ^ a.cc:107:45: error: invalid types 'int[int]' for array subscript 107 | if( weight[i] == LINF && gra[i].size() > 0 ){ | ^
s660389270
p03995
C++
#include <cstdio> #include <cmath> #include <algorithm> #include <utility> typedef long long signed int LL; typedef long long unsigned int LU; #define incID(i, l, r) for(int i = (l) ; i < (r); i++) #define incII(i, l, r) for(int i = (l) ; i <= (r); i++) #define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--) #define decII(i, l, r) for(int i = (r) ; i >= (l); i--) #define inc( i, n) incID(i, 0, n) #define inc1(i, n) incII(i, 1, n) #define dec( i, n) decID(i, 0, n) #define dec1(i, n) decII(i, 1, n) #define inII(v, l, r) ((l) <= (v) && (v) <= (r)) #define inID(v, l, r) ((l) <= (v) && (v) < (r)) template<typename T> void swap(T & x, T & y) { T t = x; x = y; y = t; return; } template<typename T> T abs(T x) { return (0 <= x ? x : -x); } template<typename T> T max(T a, T b) { return (b <= a ? a : b); } template<typename T> T min(T a, T b) { return (a <= b ? a : b); } template<typename T> bool setmin(T & a, T b) { if(a <= b) { return false; } else { a = b; return true; } } template<typename T> bool setmax(T & a, T b) { if(b <= a) { return false; } else { a = b; return true; } } template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); } template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } // ---- ---- int R, C, n; std::vector< std::pair<int, int> > vec[100000]; bool solve() { inc(i, C - 1) { std::vector< std::pair<int, int> > v2; for(auto && e : vec[i + 0]) { v2.push_back(std::make_pair(e.first * 2 + 0, e.second)); } for(auto && e : vec[i + 1]) { v2.push_back(std::make_pair(e.first * 2 + 1, e.second)); } std::sort(v2.begin(), v2.end()); int size = v2.size(); bool flag = false; int diff; inc(j, size) { int fi = v2[j].first; if(j != size - 1 && fi % 2 == 0 && fi + 1 == v2[j + 1].first) { if(! flag) { diff = v2[j].second - v2[j + 1].second; flag = true; } else { if(diff != v2[j].second - v2[j + 1].second) { return false; } } } } inc(j, size) { int fi = v2[j].first; int se = v2[j].second; if( (fi % 2 == 0 && se >= diff) || (fi % 2 == 1 && se >= -diff) ) { } else { return false; } } } return true; } int main() { scanf("%d%d%d", &R, &C, &n); inc(i, n) { int r, c, a; scanf("%d%d%d", &r, &c, &a); r--; c--; vec[c].push_back(std::make_pair(r, a)); } inc(i, C) { std::sort(vec[i].begin(), vec[i].end()); } printf("%s\n", solve() ? "Yes" : "No"); return 0; }
a.cc:35:6: error: 'vector' in namespace 'std' does not name a template type 35 | std::vector< std::pair<int, int> > vec[100000]; | ^~~~~~ a.cc:6:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 5 | #include <utility> +++ |+#include <vector> 6 | a.cc: In function 'bool solve()': a.cc:39:22: error: 'vector' is not a member of 'std' 39 | std::vector< std::pair<int, int> > v2; | ^~~~~~ a.cc:39:22: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' a.cc:39:50: error: expected primary-expression before '>' token 39 | std::vector< std::pair<int, int> > v2; | ^ a.cc:39:52: error: 'v2' was not declared in this scope 39 | std::vector< std::pair<int, int> > v2; | ^~ a.cc:40:33: error: 'vec' was not declared in this scope; did you mean 'dec'? 40 | for(auto && e : vec[i + 0]) { v2.push_back(std::make_pair(e.first * 2 + 0, e.second)); } | ^~~ | dec a.cc:41:33: error: 'vec' was not declared in this scope; did you mean 'dec'? 41 | for(auto && e : vec[i + 1]) { v2.push_back(std::make_pair(e.first * 2 + 1, e.second)); } | ^~~ | dec a.cc: In function 'int main()': a.cc:75:17: error: 'vec' was not declared in this scope; did you mean 'dec'? 75 | vec[c].push_back(std::make_pair(r, a)); | ^~~ | dec a.cc:78:31: error: 'vec' was not declared in this scope; did you mean 'dec'? 78 | inc(i, C) { std::sort(vec[i].begin(), vec[i].end()); } | ^~~ | dec
s225584886
p03995
C++
#include <cstdio> #include <cmath> #include <algorithm> #include <utility> typedef long long signed int LL; typedef long long unsigned int LU; #define incID(i, l, r) for(int i = (l) ; i < (r); i++) #define incII(i, l, r) for(int i = (l) ; i <= (r); i++) #define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--) #define decII(i, l, r) for(int i = (r) ; i >= (l); i--) #define inc( i, n) incID(i, 0, n) #define inc1(i, n) incII(i, 1, n) #define dec( i, n) decID(i, 0, n) #define dec1(i, n) decII(i, 1, n) #define inII(v, l, r) ((l) <= (v) && (v) <= (r)) #define inID(v, l, r) ((l) <= (v) && (v) < (r)) template<typename T> void swap(T & x, T & y) { T t = x; x = y; y = t; return; } template<typename T> T abs(T x) { return (0 <= x ? x : -x); } template<typename T> T max(T a, T b) { return (b <= a ? a : b); } template<typename T> T min(T a, T b) { return (a <= b ? a : b); } template<typename T> bool setmin(T & a, T b) { if(a <= b) { return false; } else { a = b; return true; } } template<typename T> bool setmax(T & a, T b) { if(b <= a) { return false; } else { a = b; return true; } } template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); } template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } // ---- ---- int R, C, n; std::vector< std::pair<int, int> > vec[100000]; bool solve() { inc(i, C - 1) { std::vector< std::pair<int, int> > v2; for(auto && e : vec[i + 0]) { v2.push_back(std::make_pair(e.first * 2 + 0, e.second)); } for(auto && e : vec[i + 1]) { v2.push_back(std::make_pair(e.first * 2 + 1, e.second)); } std::sort(v2.begin(), v2.end()); int size = v2.size(); bool flag = false; int diff; inc(j, size) { int fi = v2[j].first; if(j != size - 1 && fi % 2 == 0 && fi + 1 == v2[j + 1].first) { if(! flag) { diff = v2[j].second - v2[j + 1].second; flag = true; } else { if(diff != v2[j].second - v2[j + 1].second) { return false; } } } } inc(j, size) { int fi = v2[j].first; int se = v2[j].second; if( (fi % 2 == 0 && se >= diff) || (fi % 2 == 1 && se >= -diff) ) { } else { return false; } } } return true; } int main() { scanf("%d%d%d", &R, &C, &n); inc(i, n) { int r, c, a; scanf("%d%d%d", &r, &c, &a); r--; c--; vec[c].push_back(std::make_pair(c, a)); } inc(i, C) { std::sort(vec[i].begin(), vec[i].end()); } printf("%s\n", solve() ? "Yes" : "No"); return 0; }
a.cc:35:6: error: 'vector' in namespace 'std' does not name a template type 35 | std::vector< std::pair<int, int> > vec[100000]; | ^~~~~~ a.cc:6:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 5 | #include <utility> +++ |+#include <vector> 6 | a.cc: In function 'bool solve()': a.cc:39:22: error: 'vector' is not a member of 'std' 39 | std::vector< std::pair<int, int> > v2; | ^~~~~~ a.cc:39:22: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' a.cc:39:50: error: expected primary-expression before '>' token 39 | std::vector< std::pair<int, int> > v2; | ^ a.cc:39:52: error: 'v2' was not declared in this scope 39 | std::vector< std::pair<int, int> > v2; | ^~ a.cc:40:33: error: 'vec' was not declared in this scope; did you mean 'dec'? 40 | for(auto && e : vec[i + 0]) { v2.push_back(std::make_pair(e.first * 2 + 0, e.second)); } | ^~~ | dec a.cc:41:33: error: 'vec' was not declared in this scope; did you mean 'dec'? 41 | for(auto && e : vec[i + 1]) { v2.push_back(std::make_pair(e.first * 2 + 1, e.second)); } | ^~~ | dec a.cc: In function 'int main()': a.cc:75:17: error: 'vec' was not declared in this scope; did you mean 'dec'? 75 | vec[c].push_back(std::make_pair(c, a)); | ^~~ | dec a.cc:78:31: error: 'vec' was not declared in this scope; did you mean 'dec'? 78 | inc(i, C) { std::sort(vec[i].begin(), vec[i].end()); } | ^~~ | dec
s220060633
p03995
C++
#include<iostream> #include<vector> using namespace std; int main(void){ int R; int C; int N; string res = "Yes"; // input cin >> R; cin >> C; cin >> N; vector<int> rr(N); vector<int> cc(N); vector<int> aa(N); for (int i=1; i<=N; i++) { cin >> rr[i-1]; cin >> cc[i-1]; cin >> aa[i-1]; } //initialize vector<int> rca_flag(N, 1); vector<int> r_vec(R, 0); vector<int> c_vec(C, 0); vector<int> r_vec_flag(R, 0); vector<int> c_vec_flag(C, 0); int go_flg = 1; while (go_flg == 1){ // find first for (int i=1; i<=N; i++){ if (rca_flag[i-1] == 1){ // initailize rca_flag[i-1] = 0; r = rr[i-1]; c = cc[i-1]; a = aa[i-1]; r_vec[i-1] = a; r_vec_flag[r-1] = 1; c_vec[i-1] = 0; c_vec_flag[c-1] = 1; break; } if (i == N){ go_flg = 0; } } while (go_flg == 1){ for (int i=1; i<=N; i++){ if (rca_flag[i-1] == 1){ rca_flag[i-1] = 0; r = rr[i-1]; c = cc[i-1]; a = aa[i-1]; if ((r_vec_flag[r-1] == 1) && (c_vec_flag[c-1] == 1)){ if (a != r_vec[r-1] + c_vec[c-1]){ res = "No"; go_flg = 0; } } else if (r_vec_flag[r-1] == 1){ c_vec_flag[c-1] = 1; c_vec[c-1] = a - r_vec[r-1]; } else if (c_vec_flag[c-1] == 1){ r_vec_flag[r-1] = 1; r_vec[r-1] = a - c_vec[c-1]; } } } } } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:42:17: error: 'r' was not declared in this scope 42 | r = rr[i-1]; | ^ a.cc:43:17: error: 'c' was not declared in this scope 43 | c = cc[i-1]; | ^ a.cc:44:17: error: 'a' was not declared in this scope 44 | a = aa[i-1]; | ^ a.cc:59:21: error: 'r' was not declared in this scope 59 | r = rr[i-1]; | ^ a.cc:60:21: error: 'c' was not declared in this scope 60 | c = cc[i-1]; | ^ a.cc:61:21: error: 'a' was not declared in this scope 61 | a = aa[i-1]; | ^
s724705623
p03995
C++
#include<iostream> #include<vector> using namespace std; int main(void){ int R; int C; int N; string res = "Yes"; // input cin >> R; cin >> C; cin >> N; for (int i=1; i<=N; i++) { cin >> r[i-1]; cin >> c[i-1]; cin >> a[i-1]; } //initialize vector<int> rr(N); vector<int> cc(N); vector<int> aa(N); vector<int> rca_flag(N, 1); vector<int> r_vec(R, 0); vector<int> c_vec(C, 0); vector<int> r_vec_flag(R, 0); vector<int> c_vec_flag(C, 0); int go_flg = 1; while (go_flg == 1){ // find first for (int i=1; i<=N; i++){ if (rca_flag[i-1] == 1){ // initailize rca_flag[i-1] = 0; r = rr[i-1]; c = cc[i-1]; a = aa[i-1]; r_vec[i-1] = a; r_vec_flag[r-1] = 1; c_vec[i-1] = 0; c_vec_flag[c-1] = 1; break; } if (i == N){ go_flg = 0; } } while (go_flg == 1){ for (int i=1; i<=N; i++){ if (rca_flag[i-1] == 1){ rca_flag[i-1] = 0; r = rr[i-1]; c = cc[i-1]; a = aa[i-1]; if ((r_vec_flag[r-1] == 1) && (c_vec_flag[c-1] == 1)){ if (a != r_vec[r-1] + c_vec[c-1]){ res = "No"; go_flg = 0; } } else if (r_vec_flag[r-1] == 1){ c_vec_flag[c-1] = 1; c_vec[c-1] = a - r_vec[r-1]; } else if (c_vec_flag[c-1] == 1){ r_vec_flag[r-1] = 1; r_vec[r-1] = a - c_vec[c-1]; } } } } } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:16: error: 'r' was not declared in this scope 16 | cin >> r[i-1]; | ^ a.cc:17:16: error: 'c' was not declared in this scope 17 | cin >> c[i-1]; | ^ a.cc:18:16: error: 'a' was not declared in this scope 18 | cin >> a[i-1]; | ^ a.cc:40:17: error: 'r' was not declared in this scope 40 | r = rr[i-1]; | ^ a.cc:41:17: error: 'c' was not declared in this scope 41 | c = cc[i-1]; | ^ a.cc:42:17: error: 'a' was not declared in this scope 42 | a = aa[i-1]; | ^ a.cc:57:21: error: 'r' was not declared in this scope 57 | r = rr[i-1]; | ^ a.cc:58:21: error: 'c' was not declared in this scope 58 | c = cc[i-1]; | ^ a.cc:59:21: error: 'a' was not declared in this scope 59 | a = aa[i-1]; | ^
s659822440
p03995
C++
#include<iostream> #include<vector> using namespace std; int main(void){ int R; int C; int N; string res = "Yes"; // input cin >> R; cin >> C; cin >> N; for (i=1; i<=N; i++) { cin >> r[i-1]; cin >> c[i-1]; cin >> a[i-1]; } //initialize vector<int> rr(N); vector<int> cc(N); vector<int> aa(N); vector<int> rca_flag(N, 1); vector<int> r_vec(R, 0); vector<int> c_vec(C, 0); vector<int> r_vec_flag(R, 0); vector<int> c_vec_flag(C, 0); int go_flg = 1; while (go_flg == 1){ // find first for (int i=1; i<=N; i++){ if (rca_flag[i-1] == 1){ // initailize rca_flag[i-1] = 0; r = rr[i-1]; c = cc[i-1]; a = aa[i-1]; r_vec[i-1] = a; r_vec_flag[r-1] = 1; c_vec[i-1] = 0; c_vec_flag[c-1] = 1; break; } if (i == N){ go_flg = 0; } } while (go_flg == 1){ for (int i=1; i<=N; i++){ if (rca_flag[i-1] == 1){ rca_flag[i-1] = 0; r = rr[i-1]; c = cc[i-1]; a = aa[i-1]; if ((r_vec_flag[r-1] == 1) && (c_vec_flag[c-1] == 1)){ if (a != r_vec[r-1] + c_vec[c-1]){ res = "No"; go_flg = 0; } } else if (r_vec_flag[r-1] == 1){ c_vec_flag[c-1] = 1; c_vec[c-1] = a - r_vec[r-1]; } else if (c_vec_flag[c-1] == 1){ r_vec_flag[r-1] = 1; r_vec[r-1] = a - c_vec[c-1]; } } } } } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:10: error: 'i' was not declared in this scope 15 | for (i=1; i<=N; i++) { | ^ a.cc:16:16: error: 'r' was not declared in this scope 16 | cin >> r[i-1]; | ^ a.cc:17:16: error: 'c' was not declared in this scope 17 | cin >> c[i-1]; | ^ a.cc:18:16: error: 'a' was not declared in this scope 18 | cin >> a[i-1]; | ^ a.cc:40:17: error: 'r' was not declared in this scope 40 | r = rr[i-1]; | ^ a.cc:41:17: error: 'c' was not declared in this scope 41 | c = cc[i-1]; | ^ a.cc:42:17: error: 'a' was not declared in this scope 42 | a = aa[i-1]; | ^ a.cc:57:21: error: 'r' was not declared in this scope 57 | r = rr[i-1]; | ^ a.cc:58:21: error: 'c' was not declared in this scope 58 | c = cc[i-1]; | ^ a.cc:59:21: error: 'a' was not declared in this scope 59 | a = aa[i-1]; | ^
s646454359
p03995
C++
#include<iostream> using namespace std; int main(void){ int R; int C; int N; string res = "Yes"; // input cin >> R; cin >> C; cin >> N; for (i=1; i<=N; i++) { cin >> r[i-1]; cin >> c[i-1]; cin >> a[i-1]; } //initialize vector<int> rr(N); vector<int> cc(N); vector<int> aa(N); vector<int> rca_flag(N, 1); vector<int> r_vec(R, 0); vector<int> c_vec(C, 0); vector<int> r_vec_flag(R, 0); vector<int> c_vec_flag(C, 0); int go_flg = 1; while (go_flg == 1){ // find first for (i=1; i<=N; i++){ if (rca_flag[i-1] == 1){ // initailize rca_flag[i-1] = 0; r = rr[i-1]; c = cc[i-1]; a = aa[i-1]; r_vec[i-1] = a; r_vec_flag[r-1] = 1; c_vec[i-1] = 0; c_vec_flag[c-1] = 1; break; } if (i == N){ go_flg = 0; } } while (go_flg == 1){ for (i==1; i<=N; i++){ if (rca_flag[i-1] == 1){ rca_flag[i-1] = 0; r = rr[i-1]; c = cc[i-1]; a = aa[i-1]; if ((r_vec_flag[r-1] == 1) && (c_vec_flag[c-1] == 1)){ if (a != r_vec[r-1] + c_vec[c-1]){ res = "No"; go_flg = 0; } } else if (r_vec_flag[r-1] == 1){ c_vec_flag[c-1] = 1; c_vec[c-1] = a - r_vec[r-1]; } else if (c_vec_flag[c-1] == 1){ r_vec_flag[r-1] = 1; r_vec[r-1] = a - c_vec[c-1]; } } } } } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:10: error: 'i' was not declared in this scope 14 | for (i=1; i<=N; i++) { | ^ a.cc:15:16: error: 'r' was not declared in this scope 15 | cin >> r[i-1]; | ^ a.cc:16:16: error: 'c' was not declared in this scope 16 | cin >> c[i-1]; | ^ a.cc:17:16: error: 'a' was not declared in this scope 17 | cin >> a[i-1]; | ^ a.cc:21:5: error: 'vector' was not declared in this scope 21 | vector<int> rr(N); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include<iostream> +++ |+#include <vector> 2 | using namespace std; a.cc:21:12: error: expected primary-expression before 'int' 21 | vector<int> rr(N); | ^~~ a.cc:22:12: error: expected primary-expression before 'int' 22 | vector<int> cc(N); | ^~~ a.cc:23:12: error: expected primary-expression before 'int' 23 | vector<int> aa(N); | ^~~ a.cc:24:12: error: expected primary-expression before 'int' 24 | vector<int> rca_flag(N, 1); | ^~~ a.cc:25:12: error: expected primary-expression before 'int' 25 | vector<int> r_vec(R, 0); | ^~~ a.cc:26:12: error: expected primary-expression before 'int' 26 | vector<int> c_vec(C, 0); | ^~~ a.cc:27:12: error: expected primary-expression before 'int' 27 | vector<int> r_vec_flag(R, 0); | ^~~ a.cc:28:12: error: expected primary-expression before 'int' 28 | vector<int> c_vec_flag(C, 0); | ^~~ a.cc:35:14: error: 'i' was not declared in this scope 35 | for (i=1; i<=N; i++){ | ^ a.cc:36:17: error: 'rca_flag' was not declared in this scope 36 | if (rca_flag[i-1] == 1){ | ^~~~~~~~ a.cc:39:17: error: 'r' was not declared in this scope 39 | r = rr[i-1]; | ^ a.cc:39:21: error: 'rr' was not declared in this scope 39 | r = rr[i-1]; | ^~ a.cc:40:17: error: 'c' was not declared in this scope 40 | c = cc[i-1]; | ^ a.cc:40:21: error: 'cc' was not declared in this scope 40 | c = cc[i-1]; | ^~ a.cc:41:17: error: 'a' was not declared in this scope 41 | a = aa[i-1]; | ^ a.cc:41:21: error: 'aa' was not declared in this scope 41 | a = aa[i-1]; | ^~ a.cc:42:17: error: 'r_vec' was not declared in this scope 42 | r_vec[i-1] = a; | ^~~~~ a.cc:43:17: error: 'r_vec_flag' was not declared in this scope 43 | r_vec_flag[r-1] = 1; | ^~~~~~~~~~ a.cc:44:17: error: 'c_vec' was not declared in this scope 44 | c_vec[i-1] = 0; | ^~~~~ a.cc:45:17: error: 'c_vec_flag' was not declared in this scope 45 | c_vec_flag[c-1] = 1; | ^~~~~~~~~~ a.cc:53:18: error: 'i' was not declared in this scope 53 | for (i==1; i<=N; i++){ | ^ a.cc:54:21: error: 'rca_flag' was not declared in this scope 54 | if (rca_flag[i-1] == 1){ | ^~~~~~~~ a.cc:56:21: error: 'r' was not declared in this scope 56 | r = rr[i-1]; | ^ a.cc:56:25: error: 'rr' was not declared in this scope 56 | r = rr[i-1]; | ^~ a.cc:57:21: error: 'c' was not declared in this scope 57 | c = cc[i-1]; | ^ a.cc:57:25: error: 'cc' was not declared in this scope 57 | c = cc[i-1]; | ^~ a.cc:58:21: error: 'a' was not declared in this scope 58 | a = aa[i-1]; | ^ a.cc:58:25: error: 'aa' was not declared in this scope 58 | a = aa[i-1]; | ^~ a.cc:59:26: error: 'r_vec_flag' was not declared in this scope 59 | if ((r_vec_flag[r-1] == 1) && (c_vec_flag[c-1] == 1)){ | ^~~~~~~~~~ a.cc:59:52: error: 'c_vec_flag' was not declared in this scope 59 | if ((r_vec_flag[r-1] == 1) && (c_vec_flag[c-1] == 1)){ | ^~~~~~~~~~ a.cc:60:34: error: 'r_vec' was not declared in this scope 60 | if (a != r_vec[r-1] + c_vec[c-1]){ | ^~~~~ a.cc:60:47: error: 'c_vec' was not declared in this scope 60 | if (a != r_vec[r-1] + c_vec[c-1]){ | ^~~~~ a.cc:66:25: error: 'c_vec' was not declared in this scope 66 | c_vec[c-1] = a - r_vec[r-1]; | ^~~~~ a.cc:66:42: error: 'r_vec' was not declared in this scope 66 | c_vec[c-1] = a - r_vec[r-1]; | ^~~~~ a.cc:69:25: error: 'r_vec' was not declared in this scope 69 | r_vec[r-1] = a - c_vec[c-1]; | ^~~~~ a.cc:69:42: error: 'c_vec' was not declared in this scope 69 | r_vec[r-1] = a - c_vec[c-1]; | ^~~~~
s181646258
p03995
Java
import java.util.*; import com.sun.scenario.effect.Effect; public class Main { static final int INF = Integer.MAX_VALUE; // 2147483647 static final long LINF = Long.MAX_VALUE; // 9223372036854775807 static int DEBUG = 0; public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); int r = sc.nextInt(); int c = sc.nextInt(); int n = sc.nextInt(); int[] Rs = new int[n]; int[] Cs = new int[n]; int[] As = new int[n]; for (int i=0; i<n; i++) { Rs[i] = sc.nextInt() - 1; Cs[i] = sc.nextInt() - 1; As[i] = sc.nextInt(); } // sc.close(); int[][] Graphs = new int[r][c]; int[] NodeRs = new int[r]; int[] NodeCs = new int[c]; int[][] Edges = new int[n][3]; ArrayList<Integer> NokoriRs = new ArrayList<Integer>(); ArrayList<Integer> NokoriCs = new ArrayList<Integer>(); LinkedList<Integer> QueueRs = new LinkedList<Integer>(); LinkedList<Integer> QueueCs = new LinkedList<Integer>(); for (int i=0; i<r; i++) { for (int j=0; j<c; j++) { Graphs[i][j] = -1; } } for (int i=0; i<n; i++) { Graphs[Rs[i]][Cs[i]] = As[i]; Edges[i][0] = Rs[i]; Edges[i][1] = Cs[i]; Edges[i][2] = As[i]; } for (int i=0; i<r; i++) { NodeRs[i] = - (INF - 10); NokoriRs.add(i); } for (int i=0; i<c; i++) { NodeCs[i] = - (INF - 10); NokoriCs.add(i); } while ((NokoriRs.size() + NokoriCs.size()) > 0) { if (NokoriRs.size() > 0) { int nowNodeR = NokoriRs.get(0); NodeRs[nowNodeR] = 0; NokoriRs.remove(0); for (int i=0; i<c; i++) { int nowA = Graphs[nowNodeR][i]; if (nowA != -1) { if (NokoriCs.indexOf(i) >= 0) { QueueCs.offer(i); NodeCs[i] = nowA - NodeRs[nowNodeR]; NokoriCs.remove(NokoriCs.indexOf(i)); } } } } else { int nowNodeC = NokoriCs.get(0); NodeCs[nowNodeC] = 0; NokoriCs.remove(0); for (int i=0; i<r; i++) { int nowA = Graphs[i][nowNodeC]; if (nowA != -1) { if (NokoriRs.indexOf(i) >= 0) { QueueRs.offer(i); NodeRs[i] = nowA - NodeRs[nowNodeC]; NokoriRs.remove(NokoriRs.indexOf(i)); } } } } if (DEBUG == 1) { p("----- 1st -----"); pn("NodeRs : "); for (int i: NodeRs) { pn(i); pn(", "); } p(""); pn("NodeCs : "); for (int i: NodeCs) { pn(i); pn(", "); } p(""); pn("NokoriRs : "); for (int i: NokoriRs) { pn(i); pn(", "); } p(""); pn("NokoriCs : "); for (int i: NokoriCs) { pn(i); pn(", "); } p(""); pn("QueueRs : "); for (int i: QueueRs) { pn(i); pn(", "); } p(""); pn("QueueCs : "); for (int i: QueueCs) { pn(i); pn(", "); } p(""); int temp = sc.nextInt(); } while ((QueueRs.size() + QueueCs.size()) > 0) { if (QueueRs.size() > 0) { int nowNodeR = QueueRs.poll(); for (int i=0; i<c; i++) { int nowA = Graphs[nowNodeR][i]; if (nowA != -1) { if (NokoriCs.indexOf(i) >= 0) { QueueCs.offer(i); NodeCs[i] = nowA - NodeRs[nowNodeR]; NokoriCs.remove(NokoriCs.indexOf(i)); } } } } else { int nowNodeC = QueueCs.poll(); for (int i=0; i<r; i++) { int nowA = Graphs[i][nowNodeC]; if (nowA != -1) { if (NokoriRs.indexOf(i) >= 0) { QueueRs.offer(i); NodeRs[i] = nowA - NodeCs[nowNodeC]; NokoriRs.remove(NokoriRs.indexOf(i)); } } } } } if (DEBUG == 1) { p("----- 2nd -----"); pn("NodeRs : "); for (int i: NodeRs) { pn(i); pn(", "); } p(""); pn("NodeCs : "); for (int i: NodeCs) { pn(i); pn(", "); } p(""); pn("NokoriRs : "); for (int i: NokoriRs) { pn(i); pn(", "); } p(""); pn("NokoriCs : "); for (int i: NokoriCs) { pn(i); pn(", "); } p(""); pn("QueueRs : "); for (int i: QueueRs) { pn(i); pn(", "); } p(""); pn("QueueCs : "); for (int i: QueueCs) { pn(i); pn(", "); } p(""); int temp = sc.nextInt(); } } // 矛盾がないか確認 for (int i=0; i<n; i++) { if ((NodeRs[Edges[i][0]] + NodeCs[Edges[i][1]]) != Edges[i][2]) { p("No"); return; } } if ((min(NodeRs) + min(NodeRs)) >= 0) { p("Yes"); } else { p("No"); } } public static void p(Number a) { System.out.println(a); } public static void p(String a) { System.out.println(a); } public static void p(char a) { System.out.println(a); } public static void pn(Number a) { System.out.print(a); } public static void pn(String a) { System.out.print(a); } public static void pn(char a) { System.out.print(a); } public static void pa(String[] As) { for (int i = 0; i<As.length; i++) { pn(As[i]); pn(", "); } p(""); } public static void pa(Number[] As) { for (int i = 0; i<As.length; i++) { pn(As[i]); pn(", "); } p(""); } public static void pa(int[] As) { for (int i = 0; i<As.length; i++) { pn(As[i]); pn(", "); } p(""); } public static int powerInt(int a, int b) { return (int) Math.pow(a, b); } public static int max(int arr[]) { int max = arr[0]; for (int i=0; i<arr.length; i++) { if (max < arr[i]) { max = arr[i]; } } return max; } public static double max(double arr[]) { double max = arr[0]; for (int i=0; i<arr.length; i++) { if (max < arr[i]) { max = arr[i]; } } return max; } public static int min(int arr[]) { int max = arr[0]; for (int i=0; i<arr.length; i++) { if (max > arr[i]) { max = arr[i]; } } return max; } public static double min(double arr[]) { double max = arr[0]; for (int i=0; i<arr.length; i++) { if (max > arr[i]) { max = arr[i]; } } return max; } public static char Num2Char(int num) { return (char)(num + 'a'); } public static int Char2Num(char c) { return (int)(c - 'a'); } }
Main.java:4: error: package com.sun.scenario.effect does not exist import com.sun.scenario.effect.Effect; ^ 1 error
s600543343
p03995
Java
// package atcoder.other2016.codefestival2016.quala; import com.sun.rowset.internal.Row; import jdk.internal.util.xml.impl.Pair; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; import java.util.List; public class Main { private static final long INF = (long)1e18; public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); int r = in.nextInt(); int c = in.nextInt(); int n = in.nextInt(); int[][] num = in.nextIntTable(n, 3); for (int i = 0; i < n; i++) { num[i][0]--; num[i][1]--; } out.println(solve(r, c, num) ? "Yes" : "No"); out.flush(); } public static boolean solve(int r, int c, int[][] num) { long[][] row = solveSub(buildGraph(num, r, 1, 0)); long[][] col = solveSub(buildGraph(num, c, 0, 1)); if (row == null || col == null) { return false; } int n = num.length; for (int i = 0; i < n ; i++) { if (num[i][2] - row[0][num[i][0]] + row[1][num[i][0]] < 0) { return false; } if (num[i][2] - col[0][num[i][1]] + col[1][num[i][1]] < 0) { return false; } } return true; } static int[] que = new int[200000]; private static List<int[]>[] buildGraph(int[][] num, int c, int primary, int secondary) { int n = num.length; Arrays.sort(num, (a, b) -> (a[primary] == b[primary]) ? a[secondary] - b[secondary] : a[primary] - b[primary]); List<int[]>[] graph = new List[c]; for (int i = 0; i < c ; i++) { graph[i] = new ArrayList<>(); } for (int i = 0; i < n; ) { int j = i; while (j < n && num[i][primary] == num[j][primary]) { j++; } for (int k = i+1 ; k < j ; k++) { int c1 = num[k-1][secondary]; int c2 = num[k][secondary]; int diff = num[k][2] - num[k-1][2]; graph[c1].add(new int[]{c2, diff}); graph[c2].add(new int[]{c1, -diff}); } i = j; } return graph; } private static long[][] solveSub(List<int[]>[] graph) { int n = graph.length; long[] dp = new long[n]; long[] minValue = new long[n]; Arrays.fill(dp, INF); Arrays.fill(minValue, INF); UnionFind uf = new UnionFind(n); for (int i = 0; i < n ; i++) { if (dp[i] != INF) { continue; } int qh = 0; int qt = 0; que[qh++] = i; dp[i] = 0; long wrst = 0; while (qt < qh) { int now = que[qt++]; for (int[] e : graph[now]) { int to = e[0]; int diff = e[1]; long tv = dp[now] + diff; uf.unite(now, to); if (dp[to] == INF) { wrst = Math.min(wrst, tv); que[qh++] = to; dp[to] = tv; } else if (dp[to] != tv) { return null; } } } minValue[uf.find(i)] = wrst; } for (int i = 0; i < n ; i++) { minValue[i] = minValue[uf.find(i)]; } return new long[][]{dp, minValue}; } static class UnionFind { int[] rank; int[] parent; int[] cnt; public UnionFind(int n) { rank = new int[n]; parent = new int[n]; cnt = new int[n]; for (int i = 0; i < n ; i++) { parent[i] = i; cnt[i] = 1; } } public int find(int a) { if (parent[a] == a) { return a; } parent[a] = find(parent[a]); return parent[a]; } public void unite(int a, int b) { a = find(a); b = find(b); if (a == b) { return; } if (rank[a] < rank[b]) { parent[a] = b; cnt[b] += cnt[a]; cnt[a] = cnt[b]; } else { parent[b] = a; cnt[a] += cnt[b]; cnt[b] = cnt[a]; if (rank[a] == rank[b]) { rank[a]++; } } } public int groupCount(int a) { return cnt[find(a)]; } private boolean issame(int a, int b) { return find(a) == find(b); } } static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; public InputReader(InputStream stream) { this.stream = stream; } private int[] nextInts(int n) { int[] ret = new int[n]; for (int i = 0; i < n; i++) { ret[i] = nextInt(); } return ret; } private int[][] nextIntTable(int n, int m) { int[][] ret = new int[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { ret[i][j] = nextInt(); } } return ret; } private long[] nextLongs(int n) { long[] ret = new long[n]; for (int i = 0; i < n; i++) { ret[i] = nextLong(); } return ret; } private long[][] nextLongTable(int n, int m) { long[][] ret = new long[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { ret[i][j] = nextLong(); } } return ret; } private double[] nextDoubles(int n) { double[] ret = new double[n]; for (int i = 0; i < n; i++) { ret[i] = nextDouble(); } return ret; } private int next() { if (numChars == -1) throw new InputMismatchException(); if (curChar >= numChars) { curChar = 0; try { numChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (numChars <= 0) return -1; } return buf[curChar++]; } public char nextChar() { int c = next(); while (isSpaceChar(c)) c = next(); if ('a' <= c && c <= 'z') { return (char) c; } if ('A' <= c && c <= 'Z') { return (char) c; } throw new InputMismatchException(); } public String nextToken() { int c = next(); while (isSpaceChar(c)) c = next(); StringBuilder res = new StringBuilder(); do { res.append((char) c); c = next(); } while (!isSpaceChar(c)); return res.toString(); } public int nextInt() { int c = next(); while (isSpaceChar(c)) c = next(); int sgn = 1; if (c == '-') { sgn = -1; c = next(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c-'0'; c = next(); } while (!isSpaceChar(c)); return res*sgn; } public long nextLong() { int c = next(); while (isSpaceChar(c)) c = next(); long sgn = 1; if (c == '-') { sgn = -1; c = next(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c-'0'; c = next(); } while (!isSpaceChar(c)); return res*sgn; } public double nextDouble() { return Double.valueOf(nextToken()); } public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } static void debug(Object... o) { System.err.println(Arrays.deepToString(o)); } }
Main.java:3: error: package com.sun.rowset.internal is not visible import com.sun.rowset.internal.Row; ^ (package com.sun.rowset.internal is declared in module java.sql.rowset, which does not export it) Main.java:4: error: package jdk.internal.util.xml.impl is not visible import jdk.internal.util.xml.impl.Pair; ^ (package jdk.internal.util.xml.impl is declared in module java.base, which does not export it to the unnamed module) Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors
s877621763
p03995
C++
#include <iostream> #include <math.h> #include <vector> #include <utility> using namespace std; bool DFSUtil(int, vector<bool>&, vector<bool> &); vector<pair<int, long long>> g[1234567]; long long node[1234567] = {0}; int R, C; long long minR, minC = 1000000000; int main(){ cin >> R >> C; int N; cin >> N; for(int i = 0; i < N; i++){ int r, c; long long a; cin >> r >> c >> a; r--; c--; g[r].push_back(make_pair( c + R, a)); g[c + R].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<bool> was(R + C, false); for(int i = 0; i < R + C; i++){ if(!DFSUtil(i, visited, was)){ cout << "No"; return 0; } } cout << "Yes"; } bool DFSUtil(int v, vector<bool> &visited, vector<bool> &was){ if(visited[v]){ return true; } visited[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; long long a = g[v][i].second; if(was[w])){ if(node[v] + node[w] != a){ return false; } continue; } node[w] = a - node[v]; was[w] = true; was[v] = true; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited, was)) return false; } } return true; }
a.cc: In function 'bool DFSUtil(int, std::vector<bool>&, std::vector<bool>&)': a.cc:48:15: error: expected primary-expression before ')' token 48 | if(was[w])){ | ^
s240649209
p03995
C++
#include <iostream> #include <math.h> #include <vector> #include <utility> using namespace std; bool DFSUtil(int, vector<bool>&, vector<bool> &); vector<pair<int, long long>> g[1234567]; long long node[1234567] = {0}; int R, C; long long minR, minC = 1000000000; int main(){ cin >> R >> C; int N; cin >> N; for(int i = 0; i < N; i++){ int r, c; long long a; cin >> r >> c >> a; r--; c--; g[r].push_back(make_pair( c + R, a)); g[c + R].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<bool> was(R + C, false); if(!DFSUtil(0, visited, was)){ cout << "No"; } else{ cout << "Yes"; } } bool DFSUtil(int v, vector<bool> &visited, vector<bool> &was){ visited[v] = true; was[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; long long a = g[v][i].second; if(was[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; was[w] = true; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited)) return false; } } return true; }
a.cc: In function 'bool DFSUtil(int, std::vector<bool>&, std::vector<bool>&)': a.cc:54:18: error: too few arguments to function 'bool DFSUtil(int, std::vector<bool>&, std::vector<bool>&)' 54 | if(!DFSUtil(w, visited)) return false; | ~~~~~~~^~~~~~~~~~~~ a.cc:38:6: note: declared here 38 | bool DFSUtil(int v, vector<bool> &visited, vector<bool> &was){ | ^~~~~~~
s573481981
p03995
C++
#include <iostream> #include <math.h> #include <vector> #include <utility> using namespace std; bool DFSUtil(int, vector<bool>&, vector<bool> &); vector<pair<int, long long>> g[1234567]; long long node[1234567] = {0}; int R, C; long long minR, minC = 1000000000; int main(){ cin >> R >> C; int N; cin >> N; for(int i = 0; i < N; i++){ int r, c; long long a; cin >> r >> c >> a; r--; c--; g[r].push_back(make_pair( c + R, a)); g[c + R].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<bool> was(R + C, false); if(!DFSUtil(0, visited)){ cout << "No"; } else{ cout << "Yes"; } } bool DFSUtil(int v, vector<bool> &visited, vector<bool> &was){ visited[v] = true; was[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; long long a = g[v][i].second; if(was[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; was[w] = true; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited)) return false; } } return true; }
a.cc: In function 'int main()': a.cc:30:14: error: too few arguments to function 'bool DFSUtil(int, std::vector<bool>&, std::vector<bool>&)' 30 | if(!DFSUtil(0, visited)){ | ~~~~~~~^~~~~~~~~~~~ a.cc:8:6: note: declared here 8 | bool DFSUtil(int, vector<bool>&, vector<bool> &); | ^~~~~~~ a.cc: In function 'bool DFSUtil(int, std::vector<bool>&, std::vector<bool>&)': a.cc:54:18: error: too few arguments to function 'bool DFSUtil(int, std::vector<bool>&, std::vector<bool>&)' 54 | if(!DFSUtil(w, visited)) return false; | ~~~~~~~^~~~~~~~~~~~ a.cc:38:6: note: declared here 38 | bool DFSUtil(int v, vector<bool> &visited, vector<bool> &was){ | ^~~~~~~
s483709994
p03995
C++
#include <iostream> #include <math.h> #include <vector> #include <utility> using namespace std; bool DFSUtil(int, vector<bool>&, vector<bool> &); vector<pair<int, int>> g[1234567]; long long node[1234567] = {0}; int R, C; long long minR, minC = 1000000000; int main(){ cin >> R >> C; int N; cin >> N; for(int i = 0; i < N; i++){ int r, c, a; cin >> r >> c >> a; r--; c--; g[r].push_back(make_pair( c + C, a)); g[c + C].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<bool> was(R + C, false); if(!DFSUtil(0, visited)){ cout << "No"; } else{ cout << "Yes"; } } bool DFSUtil(int v, vector<bool> &visited, vector<bool> &was){ visited[v] = true; was[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; int a = g[v][i].second; if(was[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; was[w] = true; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited, was)) return false; } } return true; }
a.cc: In function 'int main()': a.cc:29:14: error: too few arguments to function 'bool DFSUtil(int, std::vector<bool>&, std::vector<bool>&)' 29 | if(!DFSUtil(0, visited)){ | ~~~~~~~^~~~~~~~~~~~ a.cc:8:6: note: declared here 8 | bool DFSUtil(int, vector<bool>&, vector<bool> &); | ^~~~~~~
s480380963
p03995
C++
#include <iostream> #include <math.h> #include <vector> #include <utility> using namespace std; bool DFSUtil(int, vector<bool>); vector<pair<int, int>> g[1234567]; int node[1234567]; int R, C; int main(){ cin >> R >> C; int N; cin >> N; for(int i = 0; i < N; i++){ int r, c, a; cin >> r >> c >> a; g[r].push_back(make_pair( c + C, a)); g[c + C].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<int> node(R + C, 0); int minR, minC = pow(10,9); if(!DFSUtil(0, visited)){ cout << "No"; } else{ cout << "Yes"; } } bool DFSUtil(int v, vector<bool> visited){ visited[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; int a = g[v][i].second; if(visited[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited)) return false; } } return true; }
a.cc: In function 'bool DFSUtil(int, std::vector<bool>)': a.cc:45:15: error: 'minR' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^~~~ a.cc:46:16: error: 'minC' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^~~~ a.cc:47:8: error: 'minR' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~ a.cc:47:15: error: 'minC' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~
s224876733
p03995
C++
#include <iostream> #include <math.h> #include <vector> #include <utility> using namespace std; bool DFSUtil(int, vector<bool>); vector<pair<int, int>> g[1234567]; int node[1234567]; int main(){ int R, C; cin >> R >> C; int N; cin >> N; for(int i = 0; i < N; i++){ int r, c, a; cin >> r >> c >> a; g[r].push_back(make_pair( c + C, a)); g[c + C].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<int> node(R + C, 0); int minR, minC = pow(10,9); if(!DFSUtil(0, visited)){ cout << "No"; } else{ cout << "Yes"; } } bool DFSUtil(int v, vector<bool> visited){ visited[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; int a = g[v][i].second; if(visited[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited)) return false; } } return true; }
a.cc: In function 'bool DFSUtil(int, std::vector<bool>)': a.cc:45:12: error: 'R' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^ a.cc:45:15: error: 'minR' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^~~~ a.cc:46:13: error: 'R' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^ a.cc:46:16: error: 'minC' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^~~~ a.cc:47:8: error: 'minR' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~ a.cc:47:15: error: 'minC' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~
s294152863
p03995
C++
#include <iostream> #include <math.h> #include <vector> #include <utility> using namespace std; bool DFSUtil(int, vector<bool>); vector<pair<int, int>> g[1234567]; int Node[1234567]; int main(){ int R, C; cin >> R >> C; int N; cin >> N; for(int i = 0; i < N; i++){ int r, c, a; cin >> r >> c >> a; g[r].push_back(make_pair( c + C, a)); g[c + C].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<int> node(R + C, 0); int minR, minC = pow(10,9); if(!DFSUtil(0, visited)){ cout << "No"; } else{ cout << "Yes"; } } bool DFSUtil(int v, vector<bool> visited){ visited[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; int a = g[v][i].second; if(visited[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited)) return false; } } return true; }
a.cc: In function 'bool DFSUtil(int, std::vector<bool>)': a.cc:40:22: error: 'node' was not declared in this scope; did you mean 'Node'? 40 | if(visited[w] && node[v] + node[w] != a){ | ^~~~ | Node a.cc:43:5: error: 'node' was not declared in this scope; did you mean 'Node'? 43 | node[w] = a - node[v]; | ^~~~ | Node a.cc:45:12: error: 'R' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^ a.cc:45:15: error: 'minR' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^~~~ a.cc:46:13: error: 'R' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^ a.cc:46:16: error: 'minC' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^~~~ a.cc:47:8: error: 'minR' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~ a.cc:47:15: error: 'minC' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~
s639932560
p03995
C++
#include <iostream> #include <math.h> #include <vector> #include <utility> using namespace std; bool DFSUtil(int, vector<bool>); vector<pair<int, int>> g[1234567]; int main(){ int R, C; cin >> R >> C; int N; cin >> N; for(int i = 0; i < N; i++){ int r, c, a; cin >> r >> c >> a; g[r].push_back(make_pair( c + C, a)); g[c + C].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<int> node(R + C, 0); int minR, minC = pow(10,9); if(!DFSUtil(0, visited)){ cout << "No"; } else{ cout << "Yes"; } } bool DFSUtil(int v, vector<bool> visited){ visited[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; int a = g[v][i].second; if(visited[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited)) return false; } } return true; }
a.cc: In function 'bool DFSUtil(int, std::vector<bool>)': a.cc:39:22: error: 'node' was not declared in this scope 39 | if(visited[w] && node[v] + node[w] != a){ | ^~~~ a.cc:42:5: error: 'node' was not declared in this scope 42 | node[w] = a - node[v]; | ^~~~ a.cc:44:12: error: 'R' was not declared in this scope 44 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^ a.cc:44:15: error: 'minR' was not declared in this scope 44 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^~~~ a.cc:45:13: error: 'R' was not declared in this scope 45 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^ a.cc:45:16: error: 'minC' was not declared in this scope 45 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^~~~ a.cc:46:8: error: 'minR' was not declared in this scope 46 | if(minR + minC < 0) return false; | ^~~~ a.cc:46:15: error: 'minC' was not declared in this scope 46 | if(minR + minC < 0) return false; | ^~~~
s896907153
p03995
C++
#include <iostream> #include <math.h> #include <vector> #include <utility> using namespace std; bool DFSUtil(int, vector<bool>, const vector<pair<int,int>>&[]); int main(){ int R, C; cin >> R >> C; int N; cin >> N; vector<pair<int, int>> g[C + R]; for(int i = 0; i < N; i++){ int r, c, a; cin >> r >> c >> a; g[r].push_back(make_pair( c + C, a)); g[c + C].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<int> node(R + C, 0); int minR, minC = pow(10,9); if(!DFSUtil(0, visited, g)){ cout << "No"; } else{ cout << "Yes"; } } bool DFSUtil(int v, vector<bool> visited, const vector<pair<int,int>> &g[]){ visited[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; int a = g[v][i].second; if(visited[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited,g)) return false; } } return true; }
a.cc:8:62: error: creating array of references 8 | bool DFSUtil(int, vector<bool>, const vector<pair<int,int>>&[]); | ^ a.cc:35:72: error: declaration of 'g' as array of references 35 | bool DFSUtil(int v, vector<bool> visited, const vector<pair<int,int>> &g[]){ | ^ a.cc: In function 'bool DFSUtil(...)': a.cc:36:3: error: 'visited' was not declared in this scope 36 | visited[v] = true; | ^~~~~~~ a.cc:36:11: error: 'v' was not declared in this scope 36 | visited[v] = true; | ^ a.cc:37:22: error: 'g' was not declared in this scope 37 | for(int i = 0; i < g[v].size(); i++){ | ^ a.cc:40:22: error: 'node' was not declared in this scope 40 | if(visited[w] && node[v] + node[w] != a){ | ^~~~ a.cc:43:5: error: 'node' was not declared in this scope 43 | node[w] = a - node[v]; | ^~~~ a.cc:45:12: error: 'R' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^ a.cc:45:15: error: 'minR' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^~~~ a.cc:46:13: error: 'R' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^ a.cc:46:16: error: 'minC' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^~~~ a.cc:47:8: error: 'minR' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~ a.cc:47:15: error: 'minC' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~
s981740418
p03995
C++
#include <iostream> #include <math.h> #include <vector> #include <utility> using namespace std; bool DFSUtil(int, vector<bool>, const vector<pair<int,int>>&); int main(){ int R, C; cin >> R >> C; int N; cin >> N; vector<pair<int, int>> g[C + R]; for(int i = 0; i < N; i++){ int r, c, a; cin >> r >> c >> a; g[r].push_back(make_pair( c + C, a)); g[c + C].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<int> node(R + C, 0); int minR, minC = pow(10,9); if(!DFSUtil(0, visited, g)){ cout << "No"; } else{ cout << "Yes"; } } bool DFSUtil(int v, vector<bool> visited, const vector<pair<int,int>> &g){ visited[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; int a = g[v][i].second; if(visited[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited,g)) return false; } } return true; }
a.cc: In function 'int main()': a.cc:27:27: error: invalid initialization of reference of type 'const std::vector<std::pair<int, int> >&' from expression of type 'std::vector<std::pair<int, int> > [(C + R)]' 27 | if(!DFSUtil(0, visited, g)){ | ^ a.cc:8:33: note: in passing argument 3 of 'bool DFSUtil(int, std::vector<bool>, const std::vector<std::pair<int, int> >&)' 8 | bool DFSUtil(int, vector<bool>, const vector<pair<int,int>>&); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc: In function 'bool DFSUtil(int, std::vector<bool>, const std::vector<std::pair<int, int> >&)': a.cc:37:27: error: 'const __gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'const struct std::pair<int, int>'} has no member named 'size' 37 | for(int i = 0; i < g[v].size(); i++){ | ^~~~ a.cc:38:17: error: no match for 'operator[]' (operand types are 'const __gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'const std::pair<int, int>'} and 'int') 38 | int w = g[v][i]. first; | ^ a.cc:39:17: error: no match for 'operator[]' (operand types are 'const __gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'const std::pair<int, int>'} and 'int') 39 | int a = g[v][i].second; | ^ a.cc:40:22: error: 'node' was not declared in this scope 40 | if(visited[w] && node[v] + node[w] != a){ | ^~~~ a.cc:43:5: error: 'node' was not declared in this scope 43 | node[w] = a - node[v]; | ^~~~ a.cc:45:12: error: 'R' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^ a.cc:45:15: error: 'minR' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^~~~ a.cc:46:13: error: 'R' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^ a.cc:46:16: error: 'minC' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^~~~ a.cc:47:8: error: 'minR' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~ a.cc:47:15: error: 'minC' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~
s164528967
p03995
C++
#include <iostream> #include <math.h> #include <vector> #include <utility> using namespace std; bool DFSUtil(int, vector<bool>, vector<pair<int,int>>&); int main(){ int R, C; cin >> R >> C; int N; cin >> N; vector<pair<int, int>> g[C + R]; for(int i = 0; i < N; i++){ int r, c, a; cin >> r >> c >> a; g[r].push_back(make_pair( c + C, a)); g[c + C].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<int> node(R + C, 0); int minR, minC = pow(10,9); if(!DFSUtil(0, visited, g)){ cout << "No"; } else{ cout << "Yes"; } } bool DFSUtil(int v, vector<bool> visited, vector<pair<int,int>> &g){ visited[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; int a = g[v][i].second; if(visited[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited,g)) return false; } } return true; }
a.cc: In function 'int main()': a.cc:27:27: error: invalid initialization of reference of type 'std::vector<std::pair<int, int> >&' from expression of type 'std::vector<std::pair<int, int> > [(C + R)]' 27 | if(!DFSUtil(0, visited, g)){ | ^ a.cc:8:33: note: in passing argument 3 of 'bool DFSUtil(int, std::vector<bool>, std::vector<std::pair<int, int> >&)' 8 | bool DFSUtil(int, vector<bool>, vector<pair<int,int>>&); | ^~~~~~~~~~~~~~~~~~~~~~ a.cc: In function 'bool DFSUtil(int, std::vector<bool>, std::vector<std::pair<int, int> >&)': a.cc:37:27: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'size' 37 | for(int i = 0; i < g[v].size(); i++){ | ^~~~ a.cc:38:17: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int') 38 | int w = g[v][i]. first; | ^ a.cc:39:17: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int') 39 | int a = g[v][i].second; | ^ a.cc:40:22: error: 'node' was not declared in this scope 40 | if(visited[w] && node[v] + node[w] != a){ | ^~~~ a.cc:43:5: error: 'node' was not declared in this scope 43 | node[w] = a - node[v]; | ^~~~ a.cc:45:12: error: 'R' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^ a.cc:45:15: error: 'minR' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^~~~ a.cc:46:13: error: 'R' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^ a.cc:46:16: error: 'minC' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^~~~ a.cc:47:8: error: 'minR' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~ a.cc:47:15: error: 'minC' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~
s063880002
p03995
C++
#include <iostream> #include <math.h> #include <vector> #include <utility> using namespace std; bool DFSUtil(int, vector<bool>); int main(){ int R, C; cin >> R >> C; int N; cin >> N; vector<pair<int, int>> g[C + R]; for(int i = 0; i < N; i++){ int r, c, a; cin >> r >> c >> a; g[r].push_back(make_pair( c + C, a)); g[c + C].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<int> node(R + C, 0); int minR, minC = pow(10,9); if(!DFSUtil(0, visited, g)){ cout << "No"; } else{ cout << "Yes"; } } bool DFSUtil(int v, vector<bool> visited, vector<pair<int,int>> &g){ visited[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; int a = g[v][i].second; if(visited[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited,g)) return false; } } return true; }
a.cc: In function 'int main()': a.cc:27:14: error: too many arguments to function 'bool DFSUtil(int, std::vector<bool>)' 27 | if(!DFSUtil(0, visited, g)){ | ~~~~~~~^~~~~~~~~~~~~~~ a.cc:8:6: note: declared here 8 | bool DFSUtil(int, vector<bool>); | ^~~~~~~ a.cc: In function 'bool DFSUtil(int, std::vector<bool>, std::vector<std::pair<int, int> >&)': a.cc:37:27: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'size' 37 | for(int i = 0; i < g[v].size(); i++){ | ^~~~ a.cc:38:17: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int') 38 | int w = g[v][i]. first; | ^ a.cc:39:17: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int') 39 | int a = g[v][i].second; | ^ a.cc:40:22: error: 'node' was not declared in this scope 40 | if(visited[w] && node[v] + node[w] != a){ | ^~~~ a.cc:43:5: error: 'node' was not declared in this scope 43 | node[w] = a - node[v]; | ^~~~ a.cc:45:12: error: 'R' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^ a.cc:45:15: error: 'minR' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^~~~ a.cc:46:13: error: 'R' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^ a.cc:46:16: error: 'minC' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^~~~ a.cc:47:8: error: 'minR' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~ a.cc:47:15: error: 'minC' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~
s172345908
p03995
C++
#include <iostream> #include <math.h> #include <vector> #include <utility> using namespace std; bool DFSUtil(int, vector<bool>); int main(){ int R, C; cin >> R >> C; int N; cin >> N; vector<pair<int, int>> g[C + R]; for(int i = 0; i < N; i++){ int r, c, a; cin >> r >> c >> a; g[r].push_back(make_pair( c + C, a)); g[c + C].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<int> node(R + C, 0); int minR, minC = pow(10,9); if(!DFSUtil(0, visited)){ cout << "No"; } else{ cout << "Yes"; } } bool DFSUtil(int v, vector<bool> visited){ visited[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; int a = g[v][i].second; if(visited[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited)) return false; } } return true; }
a.cc: In function 'bool DFSUtil(int, std::vector<bool>)': a.cc:37:22: error: 'g' was not declared in this scope 37 | for(int i = 0; i < g[v].size(); i++){ | ^ a.cc:40:22: error: 'node' was not declared in this scope 40 | if(visited[w] && node[v] + node[w] != a){ | ^~~~ a.cc:43:5: error: 'node' was not declared in this scope 43 | node[w] = a - node[v]; | ^~~~ a.cc:45:12: error: 'R' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^ a.cc:45:15: error: 'minR' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^~~~ a.cc:46:13: error: 'R' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^ a.cc:46:16: error: 'minC' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^~~~ a.cc:47:8: error: 'minR' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~ a.cc:47:15: error: 'minC' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~
s476740983
p03995
C++
#include <iostream> #include <math.h> #include <vector> #include <utility> using namespace std; bool DFSUtil(int, vector<bool>); int main(){ int R, C; cin >> R >> C; int N; cin >> N; vector<pair<int, int>> g[C + R]; for(int i = 0; i < N; i++){ int r, c, a; cin >> r >> c >> a; g[r].push_back(make_pair( c + C, a); g[c + C].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<int> node(R + C, 0); int minR, minC = pow(10,9); if(!DFSUtil(0, visited)){ cout << "No"; } else{ cout >> "Yes"; } } bool DFSUtil(int v, vector<bool> visited){ visited[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; int a = g[v][i].second; if(visited[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited)) return false; } } return true; }
a.cc: In function 'int main()': a.cc:20:40: error: expected ')' before ';' token 20 | g[r].push_back(make_pair( c + C, a); | ~ ^ | ) a.cc:31:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [4]') 31 | cout >> "Yes"; | ~~~~ ^~ ~~~~~ | | | | | const char [4] | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 31 | cout >> "Yes"; | ^~~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:31:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 31 | cout >> "Yes"; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = const char (&)[4]]': a.cc:31:13: required from here 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ a.cc: In function 'bool DFSUtil(int, std::vector<bool>)': a.cc:37:22: error: 'g' was not declared in this scope 37 | for(int i = 0; i < g[v].size(); i++){ | ^ a.cc:40:22: error: 'node' was not declared in this scope 40 | if(visited[w] && node[v] + node[w] != a){ | ^~~~ a.cc:43:5: error: 'node' was not declared in this scope 43 | node[w] = a - node[v]; | ^~~~ a.cc:45:12: error: 'R' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^ a.cc:45:15: error: 'minR' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^~~~ a.cc:46:13: error: 'R' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^ a.cc:46:16: error: 'minC' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^~~~ a.cc:47:8: error: 'minR' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~ a.cc:47:15: error: 'minC' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~
s976222279
p03995
C++
#include <iostream> #include <math.h> #include <vector> #include <utility> using namespace std; bool DFSUtil(int, vector<bool>); int main(){ int R, C; cin >> R >> C; int N; cin >> N; vector<pair<int, int>> g; for(int i = 0; i < N; i++){ int r, c, a; cin >> r >> c >> a; g[r].push_back(make_pair( c + C, a); g[c + C].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<int> node(R + C, 0); int minR, minC = pow(10,9); if(!DFSUtil(0, visited)){ cout << "No"; } else{ cout >> "Yes"; } } bool DFSUtil(int v, vector<bool> visited){ visited[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; int a = g[v][i].second; if(visited[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited)) return false; } } return true; }
a.cc: In function 'int main()': a.cc:20:10: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back' 20 | g[r].push_back(make_pair( c + C, a); | ^~~~~~~~~ a.cc:20:40: error: expected ')' before ';' token 20 | g[r].push_back(make_pair( c + C, a); | ~ ^ | ) a.cc:21:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back' 21 | g[c + C].push_back(make_pair(r, a)); | ^~~~~~~~~ a.cc:31:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [4]') 31 | cout >> "Yes"; | ~~~~ ^~ ~~~~~ | | | | | const char [4] | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 31 | cout >> "Yes"; | ^~~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:31:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 31 | cout >> "Yes"; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = const char (&)[4]]': a.cc:31:13: required from here 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ a.cc: In function 'bool DFSUtil(int, std::vector<bool>)': a.cc:37:22: error: 'g' was not declared in this scope 37 | for(int i = 0; i < g[v].size(); i++){ | ^ a.cc:40:22: error: 'node' was not declared in this scope 40 | if(visited[w] && node[v] + node[w] != a){ | ^~~~ a.cc:43:5: error: 'node' was not declared in this scope 43 | node[w] = a - node[v]; | ^~~~ a.cc:45:12: error: 'R' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^ a.cc:45:15: error: 'minR' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^~~~ a.cc:46:13: error: 'R' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^ a.cc:46:16: error: 'minC' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^~~~ a.cc:47:8: error: 'minR' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~ a.cc:47:15: error: 'minC' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~
s718559417
p03995
C++
#include <iostream> #include <math.h> #include <vector> #include <utility> using namespace std; bool DFSUtil(int, vector<bool>); int main(){ int R, C; cin >> R >> C; int N; cin >> N; vector<int, pair<int, int>> g; for(int i = 0; i < N; i++){ int r, c, a; cin >> r >> c >> a; g[r].push_back(make_pair( c + C, a); g[c + C].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<int> node(R + C, 0); int minR, minC = pow(10,9); if(!DFSUtil(0, visited)){ cout << "No"; } else{ cout >> "Yes"; } } bool DFSUtil(int v, vector<bool> visited){ visited[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; int a = g[v][i].second; if(visited[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited)) return false; } } return true; }
In file included from /usr/include/c++/14/vector:66, from a.cc:3: /usr/include/c++/14/bits/stl_vector.h: In instantiation of 'struct std::_Vector_base<int, std::pair<int, int> >': /usr/include/c++/14/bits/stl_vector.h:428:11: required from 'class std::vector<int, std::pair<int, int> >' 428 | class vector : protected _Vector_base<_Tp, _Alloc> | ^~~~~~ a.cc:15:31: required from here 15 | vector<int, pair<int, int>> g; | ^ /usr/include/c++/14/bits/stl_vector.h:87:28: error: no type named 'value_type' in 'struct std::pair<int, int>' 87 | rebind<_Tp>::other _Tp_alloc_type; | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:89:9: error: no type named 'value_type' in 'struct std::pair<int, int>' 89 | pointer; | ^~~~~~~ /usr/include/c++/14/bits/stl_vector.h: In instantiation of 'class std::vector<int, std::pair<int, int> >': a.cc:15:31: required from here 15 | vector<int, pair<int, int>> g; | ^ /usr/include/c++/14/bits/stl_vector.h:518:20: error: '_M_allocate' has not been declared in 'std::vector<int, std::pair<int, int> >::_Base' 518 | using _Base::_M_allocate; | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:519:20: error: '_M_deallocate' has not been declared in 'std::vector<int, std::pair<int, int> >::_Base' 519 | using _Base::_M_deallocate; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:521:20: error: '_M_get_Tp_allocator' has not been declared in 'std::vector<int, std::pair<int, int> >::_Base' 521 | using _Base::_M_get_Tp_allocator; | ^~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/requires_hosted.h:31, from /usr/include/c++/14/iostream:38, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = int; _Alloc = std::pair<int, int>]': a.cc:15:31: required from here 15 | vector<int, pair<int, int>> g; | ^ /usr/include/c++/14/bits/stl_vector.h:136:24: error: no type named 'value_type' in 'struct std::pair<int, int>' 136 | _Vector_impl() _GLIBCXX_NOEXCEPT_IF( | ^~~~~~~~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:20:6: error: no match for 'operator[]' (operand types are 'std::vector<int, std::pair<int, int> >' and 'int') 20 | g[r].push_back(make_pair( c + C, a); | ^ a.cc:20:40: error: expected ')' before ';' token 20 | g[r].push_back(make_pair( c + C, a); | ~ ^ | ) a.cc:21:6: error: no match for 'operator[]' (operand types are 'std::vector<int, std::pair<int, int> >' and 'int') 21 | g[c + C].push_back(make_pair(r, a)); | ^ a.cc:31:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [4]') 31 | cout >> "Yes"; | ~~~~ ^~ ~~~~~ | | | | | const char [4] | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 31 | cout >> "Yes"; | ^~~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:31:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 31 | cout >> "Yes"; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:31:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = const char (&)[4]]': a.cc:31:13: required from here 31 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ a.cc: In function 'bool DFSUtil(int, std::vector<bool>)': a.cc:37:22: error: 'g' was not declared in this scope 37 | for(int i = 0; i < g[v].size(); i++){ | ^ a.cc:40:22: error: 'node' was not declared in this scope 40 | if(visited[w] && node[v] + node[w] != a){ | ^~~~ a.cc:43:5: error: 'node' was not declared in this scope 43 | node[w] = a - node[v]; | ^~~~ a.cc:45:12: error: 'R' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^ a.cc:45:15: error: 'minR' was not declared in this scope 45 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^~~~ a.cc:46:13: error: 'R' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^ a.cc:46:16: error: 'minC' was not declared in this scope 46 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^~~~ a.cc:47:8: error: 'minR' was not declared in this scope 47 | if(minR + minC < 0) return false; | ^~~~ a.cc:47:15: error:
s746120097
p03995
C++
#include <iostream> #include <math.h> #include <vector> using namespace std; bool DFSUtil(int, vector<bool>); int main(){ int R, C; cin >> R >> C; int N; cin >> N; vector<int, pair<int, int>> g; for(int i = 0; i < N; i++){ int r, c, a; cin >> r >> c >> a; g[r].push_back(make_pair( c + C, a); g[c + C].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<int> node(R + C, 0); int minR, minC = pow(10,9); if(!DFSUtil(0, visited)){ cout << "No"; } else{ cout >> "Yes"; } } bool DFSUtil(int v, vector<bool> visited){ visited[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; int a = g[v][i].second; if(visited[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited)) return false; } } return true; }
In file included from /usr/include/c++/14/vector:66, from a.cc:3: /usr/include/c++/14/bits/stl_vector.h: In instantiation of 'struct std::_Vector_base<int, std::pair<int, int> >': /usr/include/c++/14/bits/stl_vector.h:428:11: required from 'class std::vector<int, std::pair<int, int> >' 428 | class vector : protected _Vector_base<_Tp, _Alloc> | ^~~~~~ a.cc:14:31: required from here 14 | vector<int, pair<int, int>> g; | ^ /usr/include/c++/14/bits/stl_vector.h:87:28: error: no type named 'value_type' in 'struct std::pair<int, int>' 87 | rebind<_Tp>::other _Tp_alloc_type; | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:89:9: error: no type named 'value_type' in 'struct std::pair<int, int>' 89 | pointer; | ^~~~~~~ /usr/include/c++/14/bits/stl_vector.h: In instantiation of 'class std::vector<int, std::pair<int, int> >': a.cc:14:31: required from here 14 | vector<int, pair<int, int>> g; | ^ /usr/include/c++/14/bits/stl_vector.h:518:20: error: '_M_allocate' has not been declared in 'std::vector<int, std::pair<int, int> >::_Base' 518 | using _Base::_M_allocate; | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:519:20: error: '_M_deallocate' has not been declared in 'std::vector<int, std::pair<int, int> >::_Base' 519 | using _Base::_M_deallocate; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:521:20: error: '_M_get_Tp_allocator' has not been declared in 'std::vector<int, std::pair<int, int> >::_Base' 521 | using _Base::_M_get_Tp_allocator; | ^~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/requires_hosted.h:31, from /usr/include/c++/14/iostream:38, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = int; _Alloc = std::pair<int, int>]': a.cc:14:31: required from here 14 | vector<int, pair<int, int>> g; | ^ /usr/include/c++/14/bits/stl_vector.h:136:24: error: no type named 'value_type' in 'struct std::pair<int, int>' 136 | _Vector_impl() _GLIBCXX_NOEXCEPT_IF( | ^~~~~~~~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:19:6: error: no match for 'operator[]' (operand types are 'std::vector<int, std::pair<int, int> >' and 'int') 19 | g[r].push_back(make_pair( c + C, a); | ^ a.cc:19:40: error: expected ')' before ';' token 19 | g[r].push_back(make_pair( c + C, a); | ~ ^ | ) a.cc:20:6: error: no match for 'operator[]' (operand types are 'std::vector<int, std::pair<int, int> >' and 'int') 20 | g[c + C].push_back(make_pair(r, a)); | ^ a.cc:30:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [4]') 30 | cout >> "Yes"; | ~~~~ ^~ ~~~~~ | | | | | const char [4] | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:30:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 30 | cout >> "Yes"; | ^~~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:30:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 30 | cout >> "Yes"; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:30:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 30 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:30:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 30 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:30:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 30 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:30:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 30 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:30:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 30 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:30:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 30 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = const char (&)[4]]': a.cc:30:13: required from here 30 | cout >> "Yes"; | ^~~~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ a.cc: In function 'bool DFSUtil(int, std::vector<bool>)': a.cc:36:22: error: 'g' was not declared in this scope 36 | for(int i = 0; i < g[v].size(); i++){ | ^ a.cc:39:22: error: 'node' was not declared in this scope 39 | if(visited[w] && node[v] + node[w] != a){ | ^~~~ a.cc:42:5: error: 'node' was not declared in this scope 42 | node[w] = a - node[v]; | ^~~~ a.cc:44:12: error: 'R' was not declared in this scope 44 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^ a.cc:44:15: error: 'minR' was not declared in this scope 44 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^~~~ a.cc:45:13: error: 'R' was not declared in this scope 45 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^ a.cc:45:16: error: 'minC' was not declared in this scope 45 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^~~~ a.cc:46:8: error: 'minR' was not declared in this scope 46 | if(minR + minC < 0) return false; | ^~~~ a.cc:46:15: error:
s321707007
p03995
C++
#include <iostream> #include <math.h> bool DFSUtil(int, vector<bool>); int main(){ int R, C; cin >> R >> C; int N; cin >> N; vector<int, pair<int, int>> g; for(int i = 0; i < N; i++){ int r, c, a; cin >> r >> c >> a; g[r].push_back(make_pair( c + C, a); g[c + C].push_back(make_pair(r, a)); } vector<bool> visited(R + C, false); vector<int> node(R + C, 0); int minR, minC = pow(10,9); if(!DFSUtil(0, visited)){ cout << "No"; } else{ cout >> "Yes"; } } bool DFSUtil(int v, vector<bool> visited){ visited[v] = true; for(int i = 0; i < g[v].size(); i++){ int w = g[v][i]. first; int a = g[v][i].second; if(visited[w] && node[v] + node[w] != a){ return false; } node[w] = a - node[v]; if(v < R) minR = minR >node[v] ? node[v] : minR; if(v >= R) minC = minC>node[v] ? node[v] : minC; if(minR + minC < 0) return false; if(!visited[w]){ if(!DFSUtil(w, visited)) return false; } } return true; }
a.cc:4:19: error: 'vector' has not been declared 4 | bool DFSUtil(int, vector<bool>); | ^~~~~~ a.cc:4:25: error: expected ',' or '...' before '<' token 4 | bool DFSUtil(int, vector<bool>); | ^ a.cc: In function 'int main()': a.cc:8:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 8 | cin >> R >> C; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:11:3: error: 'vector' was not declared in this scope 11 | vector<int, pair<int, int>> g; | ^~~~~~ a.cc:11:10: error: expected primary-expression before 'int' 11 | vector<int, pair<int, int>> g; | ^~~ a.cc:16:5: error: 'g' was not declared in this scope 16 | g[r].push_back(make_pair( c + C, a); | ^ a.cc:16:20: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'? 16 | g[r].push_back(make_pair( c + C, a); | ^~~~~~~~~ | std::make_pair In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41: /usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here 1132 | make_pair(_T1&& __x, _T2&& __y) | ^~~~~~~~~ a.cc:20:10: error: expected primary-expression before 'bool' 20 | vector<bool> visited(R + C, false); | ^~~~ a.cc:21:10: error: expected primary-expression before 'int' 21 | vector<int> node(R + C, 0); | ^~~ a.cc:23:18: error: 'visited' was not declared in this scope 23 | if(!DFSUtil(0, visited)){ | ^~~~~~~ a.cc:24:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 24 | cout << "No"; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:27:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 27 | cout >> "Yes"; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc: At global scope: a.cc:31:21: error: 'vector' has not been declared 31 | bool DFSUtil(int v, vector<bool> visited){ | ^~~~~~ a.cc:31:27: error: expected ',' or '...' before '<' token 31 | bool DFSUtil(int v, vector<bool> visited){ | ^ a.cc: In function 'bool DFSUtil(int, int)': a.cc:32:3: error: 'visited' was not declared in this scope 32 | visited[v] = true; | ^~~~~~~ a.cc:33:22: error: 'g' was not declared in this scope 33 | for(int i = 0; i < g[v].size(); i++){ | ^ a.cc:36:22: error: 'node' was not declared in this scope 36 | if(visited[w] && node[v] + node[w] != a){ | ^~~~ a.cc:39:5: error: 'node' was not declared in this scope 39 | node[w] = a - node[v]; | ^~~~ a.cc:41:12: error: 'R' was not declared in this scope 41 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^ a.cc:41:15: error: 'minR' was not declared in this scope 41 | if(v < R) minR = minR >node[v] ? node[v] : minR; | ^~~~ a.cc:42:13: error: 'R' was not declared in this scope 42 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^ a.cc:42:16: error: 'minC' was not declared in this scope 42 | if(v >= R) minC = minC>node[v] ? node[v] : minC; | ^~~~ a.cc:43:8: error: 'minR' was not declared in this scope 43 | if(minR + minC < 0) return false; | ^~~~ a.cc:43:15: error: 'minC' was not declared in this scope 43 | if(minR + minC < 0) return false; | ^~~~
s143235179
p03995
C++
#include <cstdio> #include <cmath> #include <cstring> #include <ctime> #include <climits> #include <iostream> #include <algorithm> #include <set> #include <map> #include <queue> #include <vector> #include <sstream> #include <typeinfo> #include <fstream> #define ll long long using namespace std; const ll INF = LLONG_MAX / 2 - 1; struct Edge { ll t; ll c; Edge(ll to, ll cost):t(to),c(cost){} Edge(){} }; vector<ll> weigh; ll R, C; bool DFS(ll node, vector<vector<Edge> >& edge, ll& xmin, ll& ymin) { if (node < R) xmin = min(xmin, weigh[node]); else ymin = min(ymin, weigh[node]); for (auto &to : edge[node]) { if (weigh[to.t] == INF) { weigh[to.t] = to.c - weigh[node]; if (not DFS(to.t, edge, xmin, ymin)) return false; } else { if (weigh[to.t] + weigh[node] != to.c) return false; } } return true; } int main() { cin >> R >> C; ll N; cin >> N; weigh.resize(R + C, INF); vector<vector<Edge> > edge(R+C); for(int i = 0; i < N; i++){ ll r, c, a; cin >> r >> c >> a; --r; --c; edge[r].push_back(Edge(R+c,a)); edge[R+c].push_back(Edge(r, a)); } bool res = true; ll xmin, ymin; for(int i = 0; i < R + C; i++){ if(weigh[i] == INF and edge[i].size() > 0) { xmin = ymin = numeric_limits<int>::max(); weigh[i] = 0; if (not DFS(i,edge,xmin,ymin) or xmin+ymin < 0) { cout << "No" << endl; return; } } } cout << "Yes" << endl; }
a.cc: In function 'int main()': a.cc:68:33: error: return-statement with no value, in function returning 'int' [-fpermissive] 68 | return; | ^~~~~~
s326881251
p03995
C++
#include <cstdio> #include <cmath> #include <cstring> #include <ctime> #include <climits> #include <iostream> #include <algorithm> #include <set> #include <map> #include <queue> #include <vector> #include <sstream> #include <typeinfo> #include <fstream> #define DIV 1000000007 const ll INF = LLONG_MAX / 2 - 1; using namespace std; long long R, C, N; long long r[100005]; long long c[100005]; long long a[100005]; long long w[100005]; vector<pair<long long, long long> > tree[200005]; bool dfs(int node){ for(int i = 0; i < tree[node].size(); i++){ long long next = tree[node][i].first; long long wei = tree[node][i].second; if(w[next] == INF){ w[next] = wei - w[node]; if(dfs(next) == false){ return false; } }else{ if(w[next] + w[node] != wei){ return false; } } } return true; } int main(){ cin >> R >> C >> N; for(int i = 0; i < N; i++){ cin >> r[i] >> c[i] >> a[i]; r[i]--;c[i]--; tree[r[i]].push_back(make_pair(R + c[i], a[i])); tree[R + c[i]].push_back(make_pair(r[i], a[i])); } for(int i = 0; i < R + C; i++){ w[i] = INF; } for(int i = 0; i < R + C; i++){ if(w[i] != INF){ continue; } w[i] = 0; if(dfs(i) == false){ cout << "No" << endl; return 0; } } long long xmin = INF; long long ymin = INF; for(int i = 0; i < R; i++){ xmin = min(xmin, w[i]); } for(int i = R; i < R + C; i++){ ymin = min(ymin, w[i]); } if(xmin + ymin < 0){ cout << "No" << endl; }else{ cout << "Yes" << endl; } }
a.cc:17:7: error: 'll' does not name a type 17 | const ll INF = LLONG_MAX / 2 - 1; | ^~ a.cc: In function 'bool dfs(int)': a.cc:33:31: error: 'INF' was not declared in this scope 33 | if(w[next] == INF){ | ^~~ a.cc: In function 'int main()': a.cc:57:24: error: 'INF' was not declared in this scope 57 | w[i] = INF; | ^~~ a.cc:61:28: error: 'INF' was not declared in this scope 61 | if(w[i] != INF){ | ^~~ a.cc:71:26: error: 'INF' was not declared in this scope 71 | long long xmin = INF; | ^~~