submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s517404114
p03944
C++
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { int W, H, N; cin >> W >> H >> N; int tile[100][100];//[high(y)][width(x)] memset(tile, 0, sizeof(tile));//塗られていないのを0とする int counter=0; for(int i=0; i<N; i++){ int x, y, a; cin >> x >> y >> a; if(a==1){ for(int j=0; j<x; j++){ for(int k=0; k<H; k++){ if(tile[k][j]==0){ tile[k][j]++; counter++; } } } }else if(a==2){ for(int j=W-1; j>=x; j--){ for(int k=0; k<H; k++){ if(tile[k][j]==0){ tile[k][j]++; counter++; } } } }else if(a==3){ for(int j=0; j<W; j++){ for(int k=0; k<y; k++){ if(tile[k][j]==0){ tile[k][j]++; counter++; } } } }else{ for(int j=0; j<W; j++){ for(int k=H-1; k>=y; k--){ if(tile[k][j]==0){ tile[k][j]++; counter++; } } } } } cout << H*W-counter << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:5: error: 'memset' was not declared in this scope 11 | memset(tile, 0, sizeof(tile));//塗られていないのを0とする | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <vector> +++ |+#include <cstring> 4 | using namespace std;
s578957285
p03944
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define Abs(x)((x) < 0 ? (x) * -1 : (x)) #define rep(x, y) for ((x) = 0; (x) < (y); (x)++) #define repin(x, y) for ((x) = 0; (x) <= (y); (x)++) #define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--) #define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--) #define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++) #define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++) #define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z)) #define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s)) #define repiins(x, y, z, s) for ((x) = (z); (x) <= (y); (x) += (s)) #define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++) #define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++) #define All(x) (x).begin(),(x).end() #define Mem0(x) memset(x, 0, sizeof(x)) #define Mem1(x) memset(x, -1, sizeof(x)) #define Unique(v) v.resize(unique(All(v)) - v.begin()) #define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second) #define End '\n' #define Out(x) cout<<(x)<<End #define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; } template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; } template<typename T> using V = vector<T>; template<typename T> using VV = V<V<T> >; #define pb push_back #define mp make_pair #define X first #define Y second #define lb std::lower_bound #define ub std::upper_bound #define lbi(v, x) lb(All(v), (x))-v.begin() #define ubi(v, x) ub(All(v), (x))-v.begin() static const ll MOD = 1e9 + 7; static const double PI = 3.141592653589793; #define LOCAL 0 int main() { #if LOCAL freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); freopen("debug.txt", "w", stderr); #endif cin.tie(0); ios::sync_with_stdio(false); //std::cout.precision(18); int w, h, n; cin >> w >> h >> n; int left = 0; int right = w; int top = h; int bottom = 0; int i; rep(i, n) { cin >> x >> y >> a; if (a == 1) Max(left, x); else if (a == 2) Min(right, x); else if (a == 3) Max(bottom, y); else if (a == 4) Min(top, y); } Out(max(0, right - left) * max(0, top - bottom)); return 0; }
a.cc: In function 'int main()': a.cc:79:24: error: 'x' was not declared in this scope 79 | cin >> x >> y >> a; | ^ a.cc:79:29: error: 'y' was not declared in this scope 79 | cin >> x >> y >> a; | ^ a.cc:79:34: error: 'a' was not declared in this scope 79 | cin >> x >> y >> a; | ^
s581330637
p03944
Java
import java.util.*; public class Main{ public static void main(String[]args){ Scanner sc=new Scanner(System.in); String po=sc.nextLine(); int w=sc.nextInt();int h=sc.nextInt(); int n=sc.nextInt(); int po[][]=new int[w][h]; for(int i=0;i<n;i++){ int a=sc.nextInt();int b=sc.nextInt();int c=sc.nextInt(); if(c==1){ for(int j=0;j<h;j++){ for(int k=0;k<a;k++){ po[k][j]=1; } } } else if(c==2){ for(int j=0;j<h;j++){ for(int k=a;k<w;k++){ po[k][j]=1; } } } else if(c==3){ for(int j=0;j<b;j++){ for(int k=0;k<w;k++){ po[k][j]=1; } } } else{ for(int j=b;j<h;j++){ for(int k=0;k<w;k++){ po[k][j]=1; } } } } int count=0; for(int i=0;i<w;i++){ for(int j=0;j<h;j++){ if(po[j][i]==1){ count++; } } } System.out.println(count); } }
Main.java:8: error: variable po is already defined in method main(String[]) int po[][]=new int[w][h]; ^ 1 error
s101602821
p03944
C++
import qualified Data.ByteString.Char8 as C import Data.Maybe ( fromJust ) import Control.Monad (replicateM) cReadLn :: IO Int cReadLn = fst . fromJust . C.readInt <$> C.getLine getParms :: IO [Int] getParms = map (fst . fromJust . C.readInt) . C.words <$> C.getLine main :: IO () main = do [w,h,n] <- getParms :: IO [Int] xya <- replicateM n getParms :: IO [[Int]] print $ uncurry area $ f w h xya type Range = (Int,Int) initialize :: Int -> Int -> (Range, Range) initialize w h = ((0, w), (0, h)) cut :: (Range, Range) -> [Int] -> (Range, Range) cut (xx@(xi,xf),yy@(yi,yf)) [x,y,a] | a == 1 = ((max x xi, xf), yy) | a == 2 = ((xi, min x xf), yy) | a == 3 = (xx, (max y yi, yf)) | a == 4 = (xx, (yi, min y yf)) f :: Int -> Int -> [[Int]] -> (Range, Range) f w h = foldl cut (initialize w h) area :: Range -> Range -> Int area (xi,xf) (yi,yf) | xi < xf && yi < yf = (xf-xi)*(yf-yi) | otherwise = 0
a.cc:24:8: error: stray '@' in program 24 | cut (xx@(xi,xf),yy@(yi,yf)) [x,y,a] | ^ a.cc:24:19: error: stray '@' in program 24 | cut (xx@(xi,xf),yy@(yi,yf)) [x,y,a] | ^ a.cc:1:1: error: 'import' does not name a type 1 | import qualified Data.ByteString.Char8 as C | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s870101743
p03944
C++
import qualified Data.ByteString.Char8 as C import Data.Maybe ( fromJust ) import Control.Monad (replicateM) cReadLn :: IO Int cReadLn = fst . fromJust . C.readInt <$> C.getLine getParms :: IO [Int] getParms = map (fst . fromJust . C.readInt) . C.words <$> C.getLine main :: IO () main = do [w,h,n] <- getParms :: IO [Int] xya <- replicateM n getParms :: IO [[Int]] print $ uncurry area $ f w h xya type Range = (Int,Int) initialize :: Int -> Int -> (Range, Range) initialize w h = ((0, w), (0, h)) cut :: (Range, Range) -> [Int] -> (Range, Range) cut (xx@(xi,xf),yy@(yi,yf)) [x,y,a] | a == 1 = ((max x xi, xf), yy) | a == 2 = ((xi, min x xf), yy) | a == 3 = (xx, (max y yi, yf)) | a == 4 = (xx, (yi, min y yf)) f :: Int -> Int -> [[Int]] -> (Range, Range) f w h = foldl cut (initialize w h) area :: Range -> Range -> Int area (xi,xf) (yi,yf) | xi < xf && yi < yf = (xf-xi)*(yf-yi) | otherwise = 0
a.cc:24:8: error: stray '@' in program 24 | cut (xx@(xi,xf),yy@(yi,yf)) [x,y,a] | ^ a.cc:24:19: error: stray '@' in program 24 | cut (xx@(xi,xf),yy@(yi,yf)) [x,y,a] | ^ a.cc:1:1: error: 'import' does not name a type 1 | import qualified Data.ByteString.Char8 as C | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s218830859
p03944
C
#include<stdio.h> int main() { int i=0,xi,yi,a,N; int wl,wr,hu,hd,W,H; scanf("%d %d %d",&W,&H,&N); int wl=0,hd=0,wr=W,hu=H; for(i=0;i<N;i++) { scanf("%d %d %d",&xi,&yi,&a); if(a==1) { wl=xi; } else if(a==2) { wr=xi; } else if(a==3) { hd=yi; } else { hu=yi; } } if((wl>=wr)||(hd>=hu)) { printf("0"); } else printf("%d",(hu-hd)*(wr-wl)); return 0; }
main.c: In function 'main': main.c:8:9: error: redeclaration of 'wl' with no linkage 8 | int wl=0,hd=0,wr=W,hu=H; | ^~ main.c:6:13: note: previous declaration of 'wl' with type 'int' 6 | int wl,wr,hu,hd,W,H; | ^~ main.c:8:14: error: redeclaration of 'hd' with no linkage 8 | int wl=0,hd=0,wr=W,hu=H; | ^~ main.c:6:22: note: previous declaration of 'hd' with type 'int' 6 | int wl,wr,hu,hd,W,H; | ^~ main.c:8:19: error: redeclaration of 'wr' with no linkage 8 | int wl=0,hd=0,wr=W,hu=H; | ^~ main.c:6:16: note: previous declaration of 'wr' with type 'int' 6 | int wl,wr,hu,hd,W,H; | ^~ main.c:8:24: error: redeclaration of 'hu' with no linkage 8 | int wl=0,hd=0,wr=W,hu=H; | ^~ main.c:6:19: note: previous declaration of 'hu' with type 'int' 6 | int wl,wr,hu,hd,W,H; | ^~
s755866741
p03944
C++
Loading /Users/matsuyoshi/.emacs.d/inits/12_auto-complete.el (source)... #include <iostream> #include <vector> using namespace std; int main() { int w, h, n; cin >> w >> h >> n; int max_x = w, min_x = 0; int max_y = h, min_y = 0; int x = 0, y = 0, a = 0; for (int i=0; i<n; i++) { cin >> x >> y >> a; if (a == 1) { if (x > min_x) min_x = x; } if (a == 2) { if (max_x > x) max_x = x; } if (a == 3) { if (y > min_y) min_y = y; } if (a == 4) { if (max_y > y) max_y = y; } } int ans = 0; if (max_x > min_x && max_y > min_y) ans = (max_x - min_x) * (max_y - min_y); cout << ans << endl; }
a.cc:1:1: error: 'Loading' does not name a type 1 | Loading /Users/matsuyoshi/.emacs.d/inits/12_auto-complete.el (source)... | ^~~~~~~ In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/exception_ptr.h:38, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared 140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared 142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:145:52: error: expected primary-expression before 'const' 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:147:54: error: expected primary-expression before 'const' 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive] 155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:156:70: error: expected primary-expression before 'const' 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive] 163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:164:72: error: expected primary-expression before 'const' 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared 171 | void operator delete(void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared 173 | void operator delete[](void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function 179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:179:51: error: 'size_t' is not a me
s968784433
p03944
C++
include <iostream> #include <vector> using namespace std; int main() { int w, h, n; cin >> w >> h >> n; vector<int> x(n); vector<int> y(n); vector<int> a(n); for (int i=0; i<n; i++) { cin >> x.at(i) >> y.at(i) >> a.at(i); } int max_x = w, min_x = 0; int max_y = h, min_y = 0; for (int i=0; i<n; i++) { if (a.at(i) == 1) { min_x = x.at(i); } if (a.at(i) == 2) { max_x = x.at(i); } if (a.at(i) == 3) { min_y = y.at(i); } if (a.at(i) == 4) { max_y = y.at(i); } } int ans = (max_x - min_x) * (max_y - min_y); if (ans <= 0) cout << 0 << endl; else cout << ans << endl; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/vector:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> |
s033700897
p03944
C
#include<stdio.h> int main(){ int W, H, N, x, y, a, i, l, r, u, d; scanf("%d %d %d", &W, &H, &N); l = d = 0; u = H; r = for (i = 0; i < N; i++){ scanf("%d %d %d", x, y, a); if(a == 1 && l < x){ l = x; } else if(a == 2 && r > x){ r = x; } else if(a == 3 && d < y){ d = y; } else if(a == 4 && u > y){ u = y; } } if(u > d && r > l){ printf("%d\n", (u - d)*(r - l)); } else { printf("0\n"); } return 0; }
main.c: In function 'main': main.c:10:3: error: expected expression before 'for' 10 | for (i = 0; i < N; i++){ | ^~~
s269051103
p03944
C++
#include <iostream> using namespace std; int main(){ int W, H ,N; cin >> W >> H >> N; int A[101][101]; for(int i = 0; i < W; i++){ for(int j = 0; j < H; j++){ A[i][j] = false; } } int x, y, a; for(int i = 0; i < N; i++){ cin >> x >> y >> a; if(a == 1){ for(int i = 0; i < W; i++){ for(int j = 0; j < x; j++){ A[i][j] = true; } } } if(a == 2){ for(int i = x; i < W; i++){ for(int j = 0; j < x; j++){ A[i][j] = true; } } } if(a == 3){ for(int i = 0; i < H; i++){ for(int j = 0; j < y; j++){ A[i][j] = true; } } } if(a == 4){ for(int i = y; i < H; i++){ for(int j = 0; j < y; j++){ A[i][j] = true; } } } } int count = 0; for(int i = 0; i < W; i++){ for(int j = 0; j < H; j++){ if(A[i][j] == false){ count = count + 1; } } } cout << count << endl; return 0;
a.cc: In function 'int main()': a.cc:53:12: error: expected '}' at end of input 53 | return 0; | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s633179946
p03944
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; #define MM = 1000000000; #define mod = MM + 7; #define INF (ll)1e18 #define pi acos(-1.0) #define MAX 10000000005 #define NIL -1 int main(){ int w, h; cin >> w >> h; int n; cin >> n; int x[n+2], y[n+2], a[n+2]; int p[n+1][n+1]; for(int i = 1; i < n+1; i++){ cin >> x[i] >> y[i] >> a[i]; } for(int i = 1; i < h+1; i++){ for(int j = 1; j < w; j++){ p[i][j] = 1; } } for(int i = 1; i < n+1; i++){ if(a[i] == 1){ for(int j = 1; j < h+1; j++){ for(int k = 1; k < x[i]; k++){ p[j][k] = 0; } } } else if(a[i] == 2){ for(int j = 1; j < h+1; j++){ for(int k = x[i]+1; k < w+1; k++){ p[j][k] = 0; } } } else if(a[i] == 3){ for(int j = 1; j < y[i]; j++){ for(int k = 1; k < w+1; k++){ p[j][k] = 0; } } } else { for(int j = y[i]+1; j < h+1; j++){ for(int k = 1; k < w+1; k++){ p[j][k] = 0; } } } } int count = 0; for(int i = 1; i < h+1; i++){ for(int j = 1; j < w+1; j++){ if(p[i][k]) count++; } } cout << count << endl; }
a.cc: In function 'int main()': a.cc:53:21: error: 'k' was not declared in this scope 53 | if(p[i][k]) count++; | ^
s435314166
p03944
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; #define MM = 1000000000; #define mod = MM + 7; #define INF (ll)1e18 #define pi acos(-1.0) #define MAX 10000000005 #define NIL -1 int main(){ int w, h; cin >> n >> h; int n; cin >> n; int x[n+2], y[n+2], a[n+2]; int p[n+1][n+1]; for(int i = 1; i < n+1; i++){ cin >> x[i] >> y[i] >> a[i]; } for(int i = 1; i < n+1; i++){ for(int j = 1; j < n+1; j++){ p[i][j] = 1; } } for(int i = 1; i < n+1; i++){ if(a[i] == 1){ for(int j = 1; j < n+1; j++){ for(int k = 1; k < x[i]; k++){ p[j][k] = 0; } } } else if(a[i] == 2){ for(int j = 1; j < n+1; j++){ for(int k = x[i]+1; k < n+1; k++){ p[j][k] = 0; } } } else if(a[i] == 3){ for(int j = 1; j < y[i]+1; j++){ for(int k = 1; k < x[i]; k++){ p[j][k] = 0; } } } else { for(int j = y[i]+1; j < n+1; j++){ for(int k = 1; k < n+1; k++){ p[j][k] = 0; } } } } int count = 0; for(int i = 1; i < n+1; i++){ for(int j = 1; j < n+1; j++){ if(p[i][k]) count++; } } cout << count << endl; }
a.cc: In function 'int main()': a.cc:11:22: error: 'n' was not declared in this scope 11 | int w, h; cin >> n >> h; | ^ a.cc:16:16: error: 'x' was not declared in this scope 16 | cin >> x[i] >> y[i] >> a[i]; | ^ a.cc:16:24: error: 'y' was not declared in this scope 16 | cin >> x[i] >> y[i] >> a[i]; | ^ a.cc:16:32: error: 'a' was not declared in this scope 16 | cin >> x[i] >> y[i] >> a[i]; | ^ a.cc:20:13: error: 'p' was not declared in this scope 20 | p[i][j] = 1; | ^ a.cc:24:12: error: 'a' was not declared in this scope 24 | if(a[i] == 1){ | ^ a.cc:26:36: error: 'x' was not declared in this scope 26 | for(int k = 1; k < x[i]; k++){ | ^ a.cc:27:21: error: 'p' was not declared in this scope 27 | p[j][k] = 0; | ^ a.cc:32:29: error: 'x' was not declared in this scope 32 | for(int k = x[i]+1; k < n+1; k++){ | ^ a.cc:33:21: error: 'p' was not declared in this scope 33 | p[j][k] = 0; | ^ a.cc:37:32: error: 'y' was not declared in this scope 37 | for(int j = 1; j < y[i]+1; j++){ | ^ a.cc:38:36: error: 'x' was not declared in this scope 38 | for(int k = 1; k < x[i]; k++){ | ^ a.cc:39:21: error: 'p' was not declared in this scope 39 | p[j][k] = 0; | ^ a.cc:43:25: error: 'y' was not declared in this scope 43 | for(int j = y[i]+1; j < n+1; j++){ | ^ a.cc:45:21: error: 'p' was not declared in this scope 45 | p[j][k] = 0; | ^ a.cc:53:16: error: 'p' was not declared in this scope 53 | if(p[i][k]) count++; | ^ a.cc:53:21: error: 'k' was not declared in this scope 53 | if(p[i][k]) count++; | ^
s578311617
p03944
C++
#include <bits/stdc++.h> using namespace std; int main(){ int w,h,n; cin >> w >> h >> n; int x[n],y[n],a[n]; for(int i=0; i<n; i++) cin >> x[i] >> y[i] >> a[i]; int ox = 0; int oy = 0; int px = w; int py = h; for(int i=0; i<n; i++){ if(a[i] == 1) ox = x[i]; else if(a[i] == 2) px = x[i]; else if(a[i] == 3) oy = y[i]; else if(a[i] == 4) py = y[i]; } int ans = (px-ox)*(py-oy) cout << ans << endl; }
a.cc: In function 'int main()': a.cc:23:9: error: expected ',' or ';' before 'cout' 23 | cout << ans << endl; | ^~~~
s972509877
p03944
C
#include<stdio.h> int main(void) { int W,H,N,x,y,a; int ansx = 0,ansy = 0; scanf("%d%d%d",&W,&H,&N); for(int i = 0;i < N;i++) { scanf("%d%d%d",&x,&y,&a); switch(a) { case 1: if(ansx < x){ansx = x;} break; case 2: if(x < W){W = x;} break; case 3: if(ansy < y){ansy = y;} break; case 4: if(y < H){H = y;} break; } } if(w <= x || h <= y){printf("0");} else{printf("%d",(W - ansx) * (H - ansy));} return 0; }
main.c: In function 'main': main.c:29:6: error: 'w' undeclared (first use in this function) 29 | if(w <= x || h <= y){printf("0");} | ^ main.c:29:6: note: each undeclared identifier is reported only once for each function it appears in main.c:29:16: error: 'h' undeclared (first use in this function) 29 | if(w <= x || h <= y){printf("0");} | ^
s397915650
p03944
C++
#include <bits/stdc++.h> using namespace std; int main() { int w, h, n; cin >> w >> h >> n; vector<int> x(n); vector<int> y(n); vector<int> a(n); for (int i = 0; i < n; i ++) { cin >> x.at(i) >> y.at(i) >> a.at(i); } int k = 0, l = w, m = 0, n = h; for (int i = 0; i < n; i ++) { if (a.at(i) == 1) { k = max(k, x.at(i)); } else if (a.at(i) == 2) { l = min(l, x.at(i)); } else if (a.at(i) == 3) { m = max(m, y.at(i)); } else { n = min(n, y.at(i)); } } if (l - k > 0 && n - m > 0) { cout << (l - k) * (n - m) << endl; } else { cout << 0 << endl; } }
a.cc: In function 'int main()': a.cc:14:28: error: redeclaration of 'int n' 14 | int k = 0, l = w, m = 0, n = h; | ^ a.cc:5:13: note: 'int n' previously declared here 5 | int w, h, n; | ^
s043723578
p03944
C
/* 結果: */ #define _USE_MATH_DEFINES #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <limits.h> #include <stdbool.h> #define inf (INT_MAX-1) #define INF 9223372036854775807 #define PI 3.14159265358979323846; #define EPS 1e-10 #define sq(n) ((n)*(n)) #define rep(i,n) for(i=0;i<n;i++) #define rev(i,n) for(i=n-1;i>=0;i--) /* #define sort(a,n) qsort(a,n,sizeof(TYPE),cmp) #define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r) */ #define chsort(s,n) qsort(s,n,sizeof(char),cmp) #define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r) #define TYPE long long #define ll long long #define MEMSET(a) memset(a,0,sizeof(a)) #define MEMSET_U(a) memset(a,-1,sizeof(a)) const int mod = (int)1e09 + 7; //#define DEBUG1 //#define DEBUG2 //#define DEBUGF #define DUMMY int in(void) { int i; scanf("%d", &i); return i; } long long llin(void) { long long i; scanf("%lld", &i); return i; } double din(void) { double i; scanf("%lf", &i); return i; } void chin(char s[]) { scanf("%s", s); } void print(int a) { printf("%d\n", a); } void llprint(long long a) { printf("%lld\n", a); } void dprint(double a) { printf("%.10f\n", a); } void print2(int a, int b) { printf("%d %d\n", a, b); } int Max(int a, int b) { if (a > b) { return a; }return b; } int Min(int a, int b) { if (a < b) { return a; }return b; } long long llmax(long long a, long long b) { return a > b ? a : b; } long long llmin(long long a, long long b) { return a < b ? a : b; } double dmax(double a, double b) { return a > b ? a : b; } double dmin(double a, double b) { return a < b ? a : b; } //long long llmax(long long a, long long b) { return a > b ? a : b; } //long long llmin(long long a, long long b) { return a < b ? a : b; } //double dmax(double a, double b) { return a > b ? a : b; } int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; } int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; } int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); } int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); } void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; } //int main() { // int W, H, N; // int xu = 100, xd = 0, yu = 100, yd = 0; // int ans = 0; // scanf("%d%d%d", &W, &H, &N); // xu = W; // yu = H; // int **num = (int **)malloc(sizeof(int *) * N); // for (int i = 0; i < N; i++) { // num[i] = (int *)malloc(sizeof(int) * 3); // num[i][0] = 0; // num[i][1] = 0; // num[i][2] = 0; // } // for (int i = 0; i < N; i++) { // scanf("%d%d%d", &num[i][0], &num[i][1], &num[i][2]); // if (num[i][2] == 1 && num[i][0] > xd) { xd = num[i][0]; } // if (num[i][2] == 3 && num[i][0] > yd) { yd = num[i][1]; } // if (num[i][2] == 2 && num[i][0] < xu) { xu = num[i][0]; } // if (num[i][2] == 4 && num[i][0] < yu) { yu = num[i][1]; } // } // if (xd >= xu || yd >= yu || xd >= W || xu == 0 || yd == H || yu == 0) { // // } // else { // ans = (xu - xd)*(yu - yd); // } // printf("%d\n", ans); // //#ifdef DEBUGF // getch(); //#endif // return 0; //} int main() { int W, H, N; int tmp = 0, ans = 0; scanf("%d%d%d", &W, &H, &N); int **num = (int **)malloc(sizeof(int *) * N); for (int i = 0; i < N; i++) { num[i] = (int *)malloc(sizeof(int) * 3); num[i][0] = 0; num[i][1] = 0; num[i][2] = 0; } int xmin = 0, xmax = W, ymin = 0, ymax = H; for (int i = 0; i < N; i++) { scanf("%d%d%d", &num[i][0], &num[i][1], &num[i][2]); if (num[i][2] == 1) { xmin = max(xmin, num[i][0]); } if (num[i][2] == 3) { ymin = max(ymin, num[i][1]); } if (num[i][2] == 2) { xmax = min(xmax, num[i][0]); } if (num[i][2] == 4) { ymax = min(ymax, num[i][1]); } } tmp = (xmax - xmin)*(ymax - ymin); if (tmp <= 0) { ans = 0; } else { ans = tmp; } printf("%d\n", ans); #ifdef DEBUGF getch(); #endif return 0; }
main.c: In function 'main': main.c:111:46: error: implicit declaration of function 'max'; did you mean 'Max'? [-Wimplicit-function-declaration] 111 | if (num[i][2] == 1) { xmin = max(xmin, num[i][0]); } | ^~~ | Max main.c:113:46: error: implicit declaration of function 'min'; did you mean 'Min'? [-Wimplicit-function-declaration] 113 | if (num[i][2] == 2) { xmax = min(xmax, num[i][0]); } | ^~~ | Min
s380536536
p03944
C++
#include<iostream> #include<vector> #include<algorithm> #include<set> #include<map> using namespace std; #define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i) #define REP(i, n) FOR(i, 0, n) #define PRINT(str) printf(#str "\n") #define yOUT PRINT(Yes) #define nOUT PRINT(No) #define YOUT PRINT(YES) #define NOUT PRINT(NO) #define pb(a) push_back(a) #define all(x) (x).begin(),(x).end() int main(){ int w, h, n; cin >> w >> h >> n; int ue = h, sita = 0, hidari = 0, migi = w; REP(i, n){ cin >> x >> y >> a; if(a == 1){ hidari = max(hidari, x); } else if(a == 2){ migi = min(migi, x); } else if(a == 3){ sita = max(sita, y); } else{ ue = min(ue, y); } } cout << max(migi - hidari, 0)*max(ue -sita, 0) << endl; }
a.cc: In function 'int main()': a.cc:27:16: error: 'x' was not declared in this scope 27 | cin >> x >> y >> a; | ^ a.cc:27:21: error: 'y' was not declared in this scope 27 | cin >> x >> y >> a; | ^ a.cc:27:26: error: 'a' was not declared in this scope 27 | cin >> x >> y >> a; | ^
s688353054
p03944
C++
#include<iostream> #include<vector> #include<algorithm> #include<set> #include<map> using namespace std; #define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i) #define REP(i, n) FOR(i, 0, n) #define PRINT(str) printf(#str "\n") #define yOUT PRINT(Yes) #define nOUT PRINT(No) #define YOUT PRINT(YES) #define NOUT PRINT(NO) #define pb(a) push_back(a) #define all(x) (x).begin(),(x).end() int main(){ int w, h, n; cin >> w >> h >> n; int ue = h, sita = 0, hidari = 0, migi = w; REP(i, n){ cin >> x >> y >> a; if(a[i] == 1){ hidari = max(hidari, x); } else if(a[i] == 2){ migi = min(migi, x); } else if(a[i] == 3){ sita = max(sita, y); } else{ ue = min(ue, y); } } cout << max(migi - hidari, 0)*max(ue -sita, 0) << endl; }
a.cc: In function 'int main()': a.cc:27:16: error: 'x' was not declared in this scope 27 | cin >> x >> y >> a; | ^ a.cc:27:21: error: 'y' was not declared in this scope 27 | cin >> x >> y >> a; | ^ a.cc:27:26: error: 'a' was not declared in this scope 27 | cin >> x >> y >> a; | ^
s495166750
p03944
C++
#include<bits/stdc++.h> #include <algorithm> using namespace std; int main(void){ int W, H, N; cin>>W>>H>>N; vector<int> x_min(1,0), x_max(1,W), y_min(1,0), y_max(1,H); int i,j; int tmp[3]; for(i=0;i<N;i++){ cin>>tmp[0]>>tmp[1]>>tmp[2]; if(tmp[2]==1) x_min.push_back(tmp[0]); if(tmp[2]==2) x_max.push_back(tmp[0]); if(tmp[2]==3) y_min.push_back(tmp[1]); if(tmp[2]==4) y_max.push_back(tmp[1]); } sort(x_min.begin(),x_min.end()); sort(x_max.begin(),x_max.end()); sort(y_min.begin(),y_min.end()); sort(y_max.begin(),y_max.end()); if (x_max.front()<x_min.back() or y_max.front()<y_min.back()){ cout<<0; exit(0) } cout<<max(0,((x_max.front()-x_min.back())*(y_max.front()-y_min.back()))); }
a.cc: In function 'int main()': a.cc:25:12: error: expected ';' before '}' token 25 | exit(0) | ^ | ; 26 | } | ~
s385367874
p03944
C++
#include<bits/stdc++.h> using namespace std; int c[101][101]; int b[101]; int main(){ int W,H,N,x,y,a; cin>>W>>H>>N; for(int n=1;n<=N;n++){ cin>>x>>y>>a; if(a==1){ for(int i=0;i<x;i++){ for(int j=0;j<H;j++) c[i][j]=1; } } else if(a==2){ for(int i=x;i<W;i++){ for(int j=0;j<H;j++) c[i][j]=1; } } else if(a==3){ for(int i=0;i<W;i++){ for(int j=0;j<y;j++) c[i][j]=1; } } else if(a==4){ for(int i=0;i<W;i++){ for(int j=y;j<H;j++) c[i][j]=1; } } } int ans=0; for(int i=0;i<W;i++){ for(j=0;j<H;j++) if(!c[i][j]) ans++; } cout<<ans; return 0; } //若 1,则将满足 的小矩形涂黑。 //若 2,则将满足 的小矩形涂黑。 //若 3,则将满足 的小矩形涂黑。 //若 4,则将满足 的小矩形涂黑。
a.cc: In function 'int main()': a.cc:37:21: error: 'j' was not declared in this scope 37 | for(j=0;j<H;j++) | ^
s721440541
p03944
C++
#include<bits/stdc++.h> using namespace std; int a[101][101]; int b[101]; int main(){ int W,H,N,x,y,a; cin>>W>>H>>N; for(int n=1;n<=N;n++){ cin>>x>>y>>a; if(a==1){ for(int i=0;i<x;i++){ for(int j=0;j<H;j++) c[i][j]=1; } } else if(a==2){ for(int i=x;i<W;i++){ for(int j=0;j<H;j++) c[i][j]=1; } } else if(a==3){ for(int i=0;i<W;i++){ for(int j=0;j<y;j++) c[i][j]=1; } } else if(a==4){ for(int i=0;i<W;i++){ for(int j=y;j<H;j++) c[i][j]=1; } } } int ans=0; for(int i=0;i<W;i++){ for(j=0;j<H;j++) if(!c[i][j]) ans++; } cout<<ans; return 0; } //若 1,则将满足 的小矩形涂黑。 //若 2,则将满足 的小矩形涂黑。 //若 3,则将满足 的小矩形涂黑。 //若 4,则将满足 的小矩形涂黑。
a.cc: In function 'int main()': a.cc:13:33: error: 'c' was not declared in this scope 13 | c[i][j]=1; | ^ a.cc:19:33: error: 'c' was not declared in this scope 19 | c[i][j]=1; | ^ a.cc:25:33: error: 'c' was not declared in this scope 25 | c[i][j]=1; | ^ a.cc:31:33: error: 'c' was not declared in this scope 31 | c[i][j]=1; | ^ a.cc:37:21: error: 'j' was not declared in this scope 37 | for(j=0;j<H;j++) | ^ a.cc:38:21: error: 'c' was not declared in this scope 38 | if(!c[i][j]) ans++; | ^
s125163999
p03944
C++
// 別解 #include <iostream> #include <algorithm> using namespace std; int main() { int W,H,N; cin>>W>>H>>N; int xmax=W int xmin=0; int ymax=H; int ymin=0; for(int i=0;i<N;++i){ int x,y,a; cin>>x>>y>>a; if(a==1){ if(xmin<=x) xmin=x; } if(a==2){ if(x<=xmax) xmax=x; } if(a==3){ if(ymin<=y) ymin=y; } if(a==4){ if(y<=ymax) ymax=y; } } int yoko=xmax-xmin; int tate=ymax-ymin; if(yoko<=0 || tate<=0) cout<<0<<endl; else cout<<tate*yoko<<endl; }
a.cc: In function 'int main()': a.cc:11:3: error: expected ',' or ';' before 'int' 11 | int xmin=0; | ^~~ a.cc:20:10: error: 'xmin' was not declared in this scope; did you mean 'ymin'? 20 | if(xmin<=x) | ^~~~ | ymin a.cc:40:17: error: 'xmin' was not declared in this scope; did you mean 'ymin'? 40 | int yoko=xmax-xmin; | ^~~~ | ymin
s773495273
p03944
C
#include<stdio.h> #include<iostream> using namespace std; int main() { int xx, yy, n; int x[120], y[120], a[120]; while(~scanf("%d %d %d", &xx, &yy, &n)) { int i; int ans = 0; int x1 = 0, x2 = xx, y1 = 0, y2 = yy; for(i = 0; i < n; i++) { scanf("%d %d %d", &x[i], &y[i], &a[i]); if(a[i] == 1) x1 = max(x1, x[i]); if(a[i] == 2) x2 = min(x2, x[i]); if(a[i] == 3) y1 = max(y1, y[i]); if(a[i] == 4) y2 = min(y2, y[i]); } ans = (x2 - x1) * (y2 - y1); if((x1 >= x2) || (y1 >= y2)) ans = 0; printf("%d\n", ans); } }
main.c:2:9: fatal error: iostream: No such file or directory 2 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s640753353
p03944
C++
// // Created by Tzyark on 2018/9/19. // #include <iostream> using namespace std; int c[101][101]; int main() { int W, H, N, x, y, a; cin >> W >> H >> N; memset(c, 0, sizeof(c)); for (int n = 0; n < N; n++) { cin >> x >> y >> a; if (a == 1) { for (int i = 0; i < x; i++) { for (int j = 0; j < H; j++) { c[i][j] = 1; } } } else if (a == 2) { for (int i = x; i < W; i++) { for (int j = 0; j < H; j++) { c[i][j] = 1; } } } else if (a == 3) { for (int i = 0; i < W; i++) { for (int j = 0; j < y; j++) { c[i][j] = 1; } } } else if (a == 4) { for (int i = 0; i < W; i++) { for (int j = y; j < H; j++) { c[i][j] = 1; } } } } int ans = 0; for (int i = 0; i < W; i++) { for (int j = 0; j < H; j++) { if (!c[i][j]) ans ++; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:5: error: 'memset' was not declared in this scope 10 | memset(c, 0, sizeof(c)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include <iostream> +++ |+#include <cstring> 5 | using namespace std;
s012503583
p03944
C++
#include <bits/stdc++.h> using namespace std; main() { int w, h, n; cin >> w >> h >> n; int x, y, a, g, j, k, l; g = j = 0; k = w; l = h; for (int i = 0;i<n;i++){ cin >> x >> y >> a; if(a==1&&g<x) g = x; else if(a==2&&k>x) k = x; else if(a==3&&j<y) j = y; else if(a==4&&l>y) l = y; } if(g>=k||j>=l) cout << 0 << endl; else cout << (k - g)(l - j) << endl; }
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 3 | main() | ^~~~ a.cc: In function 'int main()': a.cc:25:22: error: expression cannot be used as a function 25 | cout << (k - g)(l - j) << endl; | ~~~~~~~^~~~~~~
s738731480
p03944
C++
#include<stdio.h> #include<iostream> #include<string> #include<math.h> #include<cmath> #include<algorithm> #include<map> #include<queue> #include<stack> #include<vector> #include<time.h> #include<ctime> #include<functional> #define int long long #define itn int using namespace std; typedef pair<int, int> P; int main() { int w, h, n, x[100][100]={},a; cin >> w >> h >> n; for (int i = 0; i < n;i++) { int a, b, c; cin >> a >> b >> c; if (c == 1) { for (int j = 0; j < a; j++) { for (int k = 0; k < h; k++) { x[j][k] = 1; } } } if (c == 2) { for (int j = a; j < w; j++) { for (int k = 0; k < h; k++) { x[j][k] = 1; } } } if (c == 3) { for (int j = 0; j < w; j++) { for (int k = 0; k < b; k++) { x[j][k] = 1; } } } if (c == 4) { for (int j = 0; j < w; j++) { for (int k = b; k < h; k++) { x[j][k] = 1; } } } } for (int i = 0; i < w; i++) { for (int j = 0; j < h; j++) { if (x[i][j] == 0) { a++; } } } cout << a << endl; return 0; }
cc1plus: error: '::main' must return 'int'
s883315272
p03944
C++
#include<stdio.h> #include<iostream> #include<string> #include<math.h> #include<cmath> #include<algorithm> #include<map> #include<queue> #include<stack> #include<vector> #include<time.h> #include<ctime> #include<functional> #define int long long #define itn int using namespace std; typedef pair<int, int> P; int main() { int w, h, n, x[100][100]={},a; cin >> w >> h >> n; for (int i = 0; i < n;i++) { int a, b, c; cin >> a >> b >> c; if (c == 1) { for (int j = 0; j < a; j++) { for (int k = 0; k < h; k++) { x[j][k] = 1; } } } if (c == 2) { for (int j = a; j < w; j++) { for (int k = 0; k < h; k++) { x[j][k] = 1; } } } if (c == 3) { for (int j = 0; j < w; j++) { for (int k = 0; k < b; k++) { x[j][k] = 1; } } } if (c == 4) { for (int j = 0; j < w; j++) { for (int k = b; k < h; k++) { x[j][k] = 1; } } } } for (int i = 0; i < w; i++) { for (int j = 0; j < h; j++) { if (x[i][j] == 0) { a++; } } } cout << a << endl; getchar(); getchar(); return 0; }
cc1plus: error: '::main' must return 'int'
s999834790
p03944
C++
#include <bits/stdc++.h> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); #define llong long long #define pb(a) push_back(a) #define INF 1000000000 using namespace std; typedef pair<int, int> P; typedef pair<llong, llong> LP; typedef pair<int, P> PP; typedef pair<llong, LP> LPP; int dy[]={0, 0, 1, -1, 0}; int dx[]={1, -1, 0, 0, 0}; int main(){ cin.tie(0); ios::sync_with_stdio(false); int W,H,N,a; cin >> W >> H >> N; int xy[W][H]; for(int i=0;i<W;i++){ for(int j=0;j<H;j++){ xy[i][j] = 0; } } int x,y,a; cin >> x >> y >> a; if(a==1){ for(int i=0;i<x;i++){ for(int j=0;j<H;j++){ xy[i][j] = 1; } } } else if(a==2){ for(int i=x;i<W;i++){ for(int j=0;j<H;j++){ xy[i][j] = 1; } } } else if(a==3){ for(int i=0;i<W;i++){ for(int j=0;j<y;j++){ xy[i][j] = 1; } } } else if(a==4){ for(int i=0;i<W;i++){ for(int j=y;j<H;j++){ xy[i][j] = 1; } } } int XMin=101,YMin=101,XMax=0,YMax=0; for(int i=0;i<W;i++){ for(int j=0;j<H;j++){ if(xy[i][j]==0){ XMin = min(XMin,i); XMax = max(XMax,i); YMin = min(YMin,j); YMax = max(YMax,j); } } } cout << (XMax - XMin) * (YMax - YMin) << endl; }
a.cc: In function 'int main()': a.cc:31:11: error: redeclaration of 'int a' 31 | int x,y,a; | ^ a.cc:23:13: note: 'int a' previously declared here 23 | int W,H,N,a; | ^
s149294795
p03944
C++
#include <iostream> using namespace std; int main(){ int W,H,N; cin >> W >> H >> N; int x,y,a; int xmax,xmin,ymax,ymin; xmin = 0; xmax = W; ymin = 0; ymax = H; for(int i = 0; i < N; i++){ cin >> x >> y >> a; switch(a){ case 1: if(xmin < x) xmin = x; break; case 2: if(xmax > x) xmax = x; break; case 3: if(ymin < y) ymin = y; break; case 4: if(ymax > y) ymax = y; break; } } int xans = xmax-xmin; int yans = ymax-ymin; if(xans>=0 && yans>=0) printf("%d\n",xans*yanss); else printf("%d\n",0); }
a.cc: In function 'int main()': a.cc:32:45: error: 'yanss' was not declared in this scope; did you mean 'yans'? 32 | if(xans>=0 && yans>=0) printf("%d\n",xans*yanss); | ^~~~~ | yans
s384062181
p03944
C++
╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬ //╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓╬╬╬╬╬╬▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬ //╬╬╬╬╬╬╬╬╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓╬╬╬╬╬╬ //╬╬╬╬╬╬╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓╬╬╬╬ //╬╬╬╬╬╬╬▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓╬╬ //╬╬╬╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓ //╬╬╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬ //╬╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬ //╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬ //╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬ //▓▓╬╬╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬ //╬╬╬╬╬╬╬▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬ //╬╬╬╬▓╬╬▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬ //╬╬╬▓╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▒▒▒╬╬╬╬▓╬╬╬╬ //╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬▓╬╬▓╬╬╬╬╬╬╬╬╬▒▒▒╬╬╬╬▓╬╬╬╬ //╬╬╬▓╬╬╬╬╬╬╬╬╬▓▓╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓╬╬╬ //╬╬╬▓╬▒▒▒╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓╬╬ //╬╬╬▓╬▒▒▒╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓╬╬▓╬ //╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓╬╬╬╬▓ //╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬╬ //╬╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬╬╬ //╬╬╬╬▓▓▓╬╬╬╬╬▓▓╬╬╬╬╬▓╬╬▓╬╬╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬ //╬╬╬▓╬╬╬▓▓╬╬▓╬╬▓╬╬╬▓╬╬╬╬▓╬▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬ //╬╬▓╬╬╬╬╬╬╬▓╬╬╬▓▓▓▓▓╬╬╬╬╬▓╬╬╬▓╬▓▓▓▓▓▓╬╬╬╬ //▓▓╬╬╬╬╬╬╬╬▓╬╬╬▓╬╬╬╬▓╬╬╬╬╬▓╬╬▓▓╬╬╬╬╬╬▓▓╬╬ //╬╬╬╬╬╬╬╬╬╬▓╬╬╬▓╬╬╬╬╬▓╬╬╬╬▓╬╬╬▓╬╬╬╬╬╬╬╬▓╬ //╬╬╬╬╬╬╬╬╬╬▓╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬╬╬╬▓╬ //╬╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬╬╬╬▓ //╬╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓ //╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓╬╬▓╬╬╬╬▓ //╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓╬╬▓╬╬╬╬▓ //╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓╬▓╬╬╬╬╬▓ //╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓╬╬╬╬╬▓╬ //╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬╬▓╬ //╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬▓▓╬╬ //╬╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓╬╬╬╬ //╬╬╬╬╬╬╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓╬╬╬╬╬╬╬╬╬╬╬ #include "bits/stdc++.h" using namespace std; #define MOD 1000000007 #define INF 1LL<<50 #define fst first #define sec second #define pb push_back #define int long long #define ALL(obj) (obj).begin(), (obj).end() #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define RFOR(i,a,b) for(int i = (b-1);i>=a;i--) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) RFOR(i,0,n) #define ITR(itr,mp) for(int itr = (mp).begin(); itr != (mp).end(); ++itr) #define RITR(itr,mp) for(int itr = (mp).rbegin(); itr != (mp).rend(); ++itr) #define debug(x) cout << #x << " = " << (x) << endl; typedef long long ll; typedef pair<ll,ll> P; signed main(){ ios::sync_with_stdio(false); cin.tie(0); return 0; }
a.cc:1:1: error: extended character ╬ is not valid in an identifier 1 | ╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬ | ^ a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ▓ is not valid in an identifier a.cc:1:1: error: extended character ▓ is not valid in an identifier a.cc:1:1: error: extended character ▓ is not valid in an identifier a.cc:1:1: error: extended character ▓ is not valid in an identifier a.cc:1:1: error: extended character ▓ is not valid in an identifier a.cc:1:1: error: extended character ▓ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: extended character ╬ is not valid in an identifier a.cc:1:1: error: '\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U00002593\U00002593\U00002593\U00002593\U00002593\U00002593\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c\U0000256c' does not name a type 1 | ╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:39: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/cstddef:50, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 i
s237650479
p03944
C++
#include <iostream> #include <algorithm> #include <numeric> #include <vector> int main(void) { int W,H,N; std::cin >> W >> H >> N; int map[100][100] = {0}; for (int i = 0; i < N; ++i) { int x, y, a; std::cin >> x >> y >> a; switch (a) { case 1: for (int i = 0; i < x; i++) { for (int j = 0; j < H; j++) { map[i][j] = 1; } } break; case 2: for (int i = x; i < W; i++) { for (int j = 0; j < H; j++) { map[i][j] = 1; } } break; case 3: for (int i = 0; i < W; i++) { for (int j = 0; j < y; j++) { map[i][j] = 1; } } break; case 4: for (int i = 0; i < W; i++) { for (int j = y; j < H; j++) { map[i][j] = 1; } } break; default: break; } } int count = 0; for (int i = 0; i < W; i++) { for (int j = y; j < H; j++) { if (map[i][j] == 0) { count++; } } } std::cout << count << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:52:18: error: 'y' was not declared in this scope 52 | for (int j = y; j < H; j++) { | ^
s631943260
p03944
C++
#include <iostream> using std::cin; using std::cout; using std::endl; int main() { int w, h, n, s; // 長方形を作るx座標の左端、右端を表す(xp[0]: 右, xp[1]: 左) int xp[2]; // 長方形を作るy座標の上端、下端を表す(yp[0]: 上, yp[1]: 下) int yp[2]; cin >> w >> h >> n; // 初期位置をセット xp[0] = w; xp[1] = 0; yp[0] = h; yp[1] = 0; for (int i = 0; i < n; i++) { int x, y, a; cin >> x >> y >> a; if (a == 1 && xp[1] < x) { xp[1] = x; } else if (a == 2 && xp[0] > x) { xp[0] = x; } else if (a == 3 && yp[1] < y) { yp[1] = y; } else if(yp[0] > y){ yp[0] = y; } } if ((xp[0] - xp[1]) <= 0 || (yp[0] - yp[1] <= 0)) { cout << 0 << endl; } else { s = (xp[0] - xp[1]) * (yp[0] - yp[1]); cout << s << endl; } return 0; }
a.cc:25:14: error: extended character   is not valid in an identifier 25 | if (a == 1 && xp[1] < x) { | ^ a.cc: In function 'int main()': a.cc:25:14: error: unable to find numeric literal operator 'operator""\U00003000' 25 | if (a == 1 && xp[1] < x) { | ^~~
s681293861
p03944
C++
#include <iostream> using std::cin; using std::cout; using std::endl; int main() { int w, h, n, s; // 長方形を作るx座標の左端、右端を表す(xp[0]: 右, xp[1]: 左) int xp[2]; // 長方形を作るy座標の上端、下端を表す(yp[0]: 上, xp[1]: 下) int yp[2]; cin >> w >> h >> n; xp[0] = w; xp[1] = 0; yp[0] = h; yp[1] = 0; for (int i = 0; i < n; i++) { int x, y, a; cin >> x >> y >> a; if (a == 1) { if (xp[1] > x) { xp[1] = x; } } else if (a == 2) { if (xp[0] > x) { xp[0] = x; } } else if (a == 3) { if (yp[1] > y) { yp[1] = y; } } else { if (yp[0] > y) { yp[0] = y; } } } if ((xp[0] - xp[1]) <= 0 || (yp[0] - yp[1] <= 0)) { cout << 0 << endl; } else { s = (xp[0] - xp[1]) * (yp[0] - yp[1]); cout << s << endl; } return 0; }
a.cc:34:21: error: extended character   is not valid in an identifier 34 | if (yp[1] > y) { | ^ a.cc: In function 'int main()': a.cc:34:21: error: '\U00003000' was not declared in this scope 34 | if (yp[1] > y) { | ^~
s873676346
p03944
C++
#include <iostream> using std::cin; using std::cout; using std::endl; int main() { int w, h, n, s; // 長方形を作るx座標の左端、右端を表す(x[0]: 右, x[1]: 左) int xp[2]; // 長方形を作るy座標の上端、下端を表す(y[0]: 上, x[1]: 下) int yp[2]; cin >> w >> h >> n; xp[0] = w; xp[1] = 0; yp[0] = h; yp[1] = 0; for (int i = 0; i < n; i++) { int x, y, a; cin >> x >> y >> a; if (a == 1) { xp[1] = x; } else if (a == 2) { xp[0] = x; } else if (a == 3) { yp[1] = y; } else { yp[0] = y; } } if (xp[0] - xp[1]) > 0 && yp[0] - yp[1] > 0) { s = (xp[0] - xp[1]) * (yp[0] - yp[1]); cout << s << endl; } else { cout << 0 << endl; } return 0; }
a.cc: In function 'int main()': a.cc:34:22: error: expected primary-expression before '>' token 34 | if (xp[0] - xp[1]) > 0 && yp[0] - yp[1] > 0) { | ^
s069555816
p03944
Java
import java.util.Scanner; public class SnukesColoring2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int w = sc.nextInt(); int h = sc.nextInt(); int n = sc.nextInt(); int[] x = new int [n]; int[] y = new int [n]; int[] a = new int [n]; for (int i = 0 ; i < n ; i++) { x[i] = sc.nextInt(); y[i] = sc.nextInt(); a[i] = sc.nextInt(); } int minX = 0; int maxX = w; int minY = 0; int maxY = h; for (int i = 0 ; i < n ; i++) { if (a[i] == 1) { minX = Math.max(minX, x[i]); } else if (a[i] == 2) { maxX = Math.min(maxX, x[i]); } else if (a[i] == 3) { minY = Math.max(minY, y[i]); } else { maxY = Math.min(maxY, y[i]); } } if (minX >= maxX || minY >= maxY) { System.out.println(0); } else { System.out.println((maxX - minX) * (maxY - minY)); } } }
Main.java:3: error: class SnukesColoring2 is public, should be declared in a file named SnukesColoring2.java public class SnukesColoring2 { ^ 1 error
s720420551
p03944
C++
#include <bits/stdc++.h> using namespace std; int main() { int W,H,N; int x[110],b[110],a[110]; cin >> W>> H>> N; int num[110][110]; for(int i=0;i<N;i++) cin >> x[i] >> y[i] >> e[i]; int a=0,b=w,c=0,d=h; for(int i0;i<N;i++){ if(f[i]==1)a=max(a,x[i]); if(f[i]==2)b=min(b,x[i]); if(f[i]==3)c=max(c,y[i]); if(f[i]==4)d=min(d,y[i]); } cout <<max(0,b-a)*max(0,d-x)<<endl; }
a.cc: In function 'int main()': a.cc:9:45: error: 'y' was not declared in this scope 9 | for(int i=0;i<N;i++) cin >> x[i] >> y[i] >> e[i]; | ^ a.cc:9:53: error: 'e' was not declared in this scope 9 | for(int i=0;i<N;i++) cin >> x[i] >> y[i] >> e[i]; | ^ a.cc:10:13: error: conflicting declaration 'int a' 10 | int a=0,b=w,c=0,d=h; | ^ a.cc:6:27: note: previous declaration as 'int a [110]' 6 | int x[110],b[110],a[110]; | ^ a.cc:10:17: error: conflicting declaration 'int b' 10 | int a=0,b=w,c=0,d=h; | ^ a.cc:6:20: note: previous declaration as 'int b [110]' 6 | int x[110],b[110],a[110]; | ^ a.cc:10:19: error: 'w' was not declared in this scope 10 | int a=0,b=w,c=0,d=h; | ^ a.cc:11:20: error: 'i' was not declared in this scope; did you mean 'i0'? 11 | for(int i0;i<N;i++){ | ^ | i0 a.cc:12:20: error: 'f' was not declared in this scope 12 | if(f[i]==1)a=max(a,x[i]); | ^ a.cc:13:20: error: 'f' was not declared in this scope 13 | if(f[i]==2)b=min(b,x[i]); | ^ a.cc:14:20: error: 'f' was not declared in this scope 14 | if(f[i]==3)c=max(c,y[i]); | ^ a.cc:14:28: error: 'c' was not declared in this scope 14 | if(f[i]==3)c=max(c,y[i]); | ^ a.cc:14:36: error: 'y' was not declared in this scope 14 | if(f[i]==3)c=max(c,y[i]); | ^ a.cc:15:20: error: 'f' was not declared in this scope 15 | if(f[i]==4)d=min(d,y[i]); | ^ a.cc:15:28: error: 'd' was not declared in this scope 15 | if(f[i]==4)d=min(d,y[i]); | ^ a.cc:15:36: error: 'y' was not declared in this scope 15 | if(f[i]==4)d=min(d,y[i]); | ^ a.cc:17:19: error: no matching function for call to 'max(int, long int)' 17 | cout <<max(0,b-a)*max(0,d-x)<<endl; | ~~~^~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:17:19: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long int') 17 | cout <<max(0,b-a)*max(0,d-x)<<endl; | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:17:19: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 17 | cout <<max(0,b-a)*max(0,d-x)<<endl; | ~~~^~~~~~~ a.cc:17:33: error: 'd' was not declared in this scope 17 | cout <<max(0,b-a)*max(0,d-x)<<endl; | ^
s380014377
p03944
C++
#include <bits/stdc++.h> using namespace std; int main() { int W, H, N; cin >> W >> H >> N; int xf = 0; int yf = 0; for(int i = 0;i < N;i++){ int x, y, a; cin >> x >> y >> a; if(a == 1){ W -= x - xf; xf += x - xf; } else if(a == 2){ if(W + xf > x){ W = x - xf; } } else if(a == 3){ H -= y - yf; yf += y - yf; } else if(a == 4){ if(H + yf > y){ H = y - yf; } } } if(W < 1 || H < 1){ cout << 0 << endl; return 0; } cout << W*H << endl; }#include <bits/stdc++.h> using namespace std; int main() { int W, H, N; cin >> W >> H >> N; int xf = 0; int yf = 0; for(int i = 0;i < N;i++){ int x, y, a; cin >> x >> y >> a; if(a == 1){ W -= x - xf; xf += x - xf; } else if(a == 2){ if(W + xf > x){ W = x - xf; } } else if(a == 3){ H -= y - yf; yf += y - yf; } else if(a == 4){ if(H + yf > y){ H = y - yf; } } } if(W < 1 || H < 1){ cout << 0 << endl; return 0; } cout << W*H << endl; }#include <bits/stdc++.h> using namespace std; int main() { int W, H, N; cin >> W >> H >> N; int xf = 0; int yf = 0; for(int i = 0;i < N;i++){ int x, y, a; cin >> x >> y >> a; if(a == 1){ W -= x - xf; xf += x - xf; } else if(a == 2){ if(W + xf > x){ W = x - xf; } } else if(a == 3){ H -= y - yf; yf += y - yf; } else if(a == 4){ if(H + yf > y){ H = y - yf; } } } if(W < 1 || H < 1){ cout << 0 << endl; return 0; } cout << W*H << endl; }
a.cc:36:2: error: stray '#' in program 36 | }#include <bits/stdc++.h> | ^ a.cc:71:2: error: stray '#' in program 71 | }#include <bits/stdc++.h> | ^ a.cc:36:3: error: 'include' does not name a type 36 | }#include <bits/stdc++.h> | ^~~~~~~ a.cc:39:5: error: redefinition of 'int main()' 39 | int main() { | ^~~~ a.cc:4:5: note: 'int main()' previously defined here 4 | int main() { | ^~~~ a.cc:71:3: error: 'include' does not name a type 71 | }#include <bits/stdc++.h> | ^~~~~~~ a.cc:74:5: error: redefinition of 'int main()' 74 | int main() { | ^~~~ a.cc:4:5: note: 'int main()' previously defined here 4 | int main() { | ^~~~
s298365604
p03944
C++
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { int i,j,k,m,n,w,h; int ansx,ansy; cin>>w>>h>>n; int x,y,a; int shang=h,xia=0,zuo=0,you=w; for(i=1; i<=n; i++) { cin>>x>>y>>a; if(a==1) zuo=max(x,zuo); if(a==2) you=min(x,you); if(a==3) xia=max(y,xia); if(a==4) shang=min(y,shang); } if(you-zuo)*(shang-xia)<=0) { cout<<0<<endl; return 0; } cout<<(you-zuo)*(shang-xia)<<endl; return 0; }
a.cc: In function 'int main()': a.cc:23:16: error: invalid type argument of unary '*' (have 'int') 23 | if(you-zuo)*(shang-xia)<=0) | ^~~~~~~~~~~~
s449347723
p03944
C++
// バケット法による解 #include <iostream> #include <string> using namespace std; int main() { int W, H, N; cin >> W >> H >> N; int XY[N][3]; for (int i = 0; i < N; ++i) cin >> XY[i][0] >> XY[i][1] >> XY[i][2]; int a[4] = {0}; // バケット a[0] = 0; // left a[1] = W; // right a[2] = 0; // bottom a[3] = H; // top for (int i = 0; i < N; ++i) { if (XY[i][2]==0+1 & a[0]<=XY[i][0]) a[0] = XY[i][0]; if (XY[i][2]==1+1 & a[1]>=XY[i][0]) a[1] = XY[i][0]; if (XY[i][2]==2+1 & a[2]<=XY[i][1]) a[2] = XY[i][1]; if (XY[i][2]==3+1 & a[3]>=XY[i][1]) a[3] = XY[i][1]; } for (int i = 0; i < 4; ++i) { //cout << a[i] << endl; } int area = (a[1] - a[0]) * (a[3] - a[2]) if (a[1] - a[0] <=0 | a[3] - a[2]) area = 0; cout << (a[1] - a[0]) * (a[3] - a[2]) << endl; }
a.cc: In function 'int main()': a.cc:28:5: error: expected ',' or ';' before 'if' 28 | if (a[1] - a[0] <=0 | a[3] - a[2]) area = 0; | ^~
s151057454
p03944
C++
#include <iostream> #include <algorithm> #include <cmath> #include <limits> #include <vector> using namespace std; int main (void) { int W=0, H=0, N=0; cin >> W >> H >> N; int x=0,y=0,a=0; int W1=0, W2=0, H1=0, H2=0; for (int i=0; i<N; i++) { cin >> x >> y >> a; switch (a) { case 1: W1=max(W1,x); break; case 2: W2=max(W2,W-x); break; case 3: H1=max(H1,y); break; case 4: H2=max(H2,H-y); break; } } int ans = max(0,(W-W1-W2)*(H-H1-H2)); cout << ans; } }
a.cc:33:1: error: expected declaration before '}' token 33 | } | ^
s421082882
p03944
C++
#include <iostream> #include <algorithm> #include <cmath> #include <limits> #include <vector> using namespace std; int main (void) { int W=0, H=0, N=0; cin >> W >> H >> N; int x,y,a=0; int W1=0, W2=0, H1=0, H2=0; for (int i=0; i<N; i++) { cin >> x >> y >> a; switch (a) { case 1: W1=max(W1,x); break; case 2: W2=max(W2,W-x); break; case 3: H1=max(H1,y); break; case 4: H2=max(H2,H-y); break; } } int ans = (W-W1-W2)*(H-H1-H2); if (ans <= 0) { ans =0; cout << ans; } if (ans >0 ){ cout << ans; } }
a.cc:31:7: error: extended character   is not valid in an identifier 31 | if (ans <= 0) { | ^ a.cc:31:14: error: extended character   is not valid in an identifier 31 | if (ans <= 0) { | ^ a.cc: In function 'int main()': a.cc:31:7: error: 'ans\U00003000' was not declared in this scope 31 | if (ans <= 0) { | ^~~~~ a.cc:31:14: error: '\U000030000' was not declared in this scope 31 | if (ans <= 0) { | ^~~
s717738650
p03944
C++
#include <iostream> #include <algorithm> #include <cmath> #include <limits> #include <vector> using namespace std; int main (void) { int W, H, N; cin >> W >> H >> N; int x,y,a=0; int W1=0, W2=0, H1=0, H2=0; for (int i=0; i<N; i++) { cin >> x >> y >> a; switch (a) { case 1: W1=max(W1,x); break; case 2: W2=max(W2,W-x); break; case 3: H1=max(H1,y); break; case 4: H2=max(H2,H-y); break; } } int ans = (W-W1-W2)*(H-H1-H2); if (ans<0) { ans =0; cout << ans; break; } if (ans >0 ){ cout << ans; } }
a.cc: In function 'int main()': a.cc:34:5: error: break statement not within loop or switch 34 | break; | ^~~~~
s900819980
p03944
C++
#include <bits/stdc++.h> using namespace std; typedef long long int llint; int main(){ int w, h, n, i; int x[110], y[110], a[110]; cin>>w>>h>>n; int maxx=0, minx=w, maxy=0, miny=h; for(i=0; i<n; i++) cin>>x[i]>>y[i]>>a[i]; for(i=0; i<n; i++){ if(a[i]==1 && x[i]>maxx) maxx=x[i]; if(a[i]==2 && x[i]<minx) minx=x[i]; if(a[i]==3 && y[i]>maxy) maxy=y[i]; if(a[i]==4 && y[i]<miny) miny=y[i]; } if((maxx-minx)>0 && (maxy-miny)>0) cout<<(maxx-minx)*(maxy-miny)<<endl; else cout<0<<endl; return 0; }
a.cc: In function 'int main()': a.cc:18:20: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 18 | else cout<0<<endl; | ~^~~~~~
s697442415
p03944
C++
#include <bits/stdc++.h> using namespace std; typedef long long int llint; int main(){ int w, h, n, i; int x[110], y[110], a[110]; cin>>w>>h>>n; int maxx=0, minx=w, maxy=0, miny=h; for(i=0; i<n; i++) cin>>x[i]>>y[i]>>a[i]; for(i=0; i<n; i++){ if(a[i]==1 && x[i]>maxx) maxx=x[i]; if(a[i]==2 && x[i]<minx) minx=x[i]; if(a[i]==3 && y[i]>maxy) maxy=y[i]; if(a[i]==4 && y[i]<miny) miny=y[i]; } if((maxx-minx)>0 && (maxy-miny)>0) cout<<(maxx-minx)*(maxy-miny)<<endl; else cout<,0<<endl; return 0; }
a.cc: In function 'int main()': a.cc:18:19: error: expected primary-expression before ',' token 18 | else cout<,0<<endl; | ^ a.cc:18:21: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 18 | else cout<,0<<endl; | ~^~~~~~
s933968495
p03944
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int W = sc.nextInt(); int H = sc.nextInt(); int N = sc.nextInt(); int l = 0;int r = W;int u = H;int d = 0; int[] x = new int[3*N]; for(int i = 0;i < 3*N;i += 3){ x[i] = sc.nextInt(); x[i+1] = sc.nextInt(); x[i+2] = sc.nextInt(); if(x[i+2] == 1){ if(l <= x[i])l = x[i]; } else if(x[i+2] == 2){ if(x[i] <= r)r = x[i]; } else if(x[i+2] == 3){ if(d <= x[i+1])d = x[i+1]; } else{ if(x[i+1] <= u)u = x[i+1]; } } if(r-l >= 0 && u-d >= 0)System.out.println((r-l)*(u-d)); else system.out.println("0"); }}
Main.java:28: error: package system does not exist else system.out.println("0"); ^ 1 error
s352557314
p03944
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int W = sc.nextInt(); int H = sc.nextInt(); int N = sc.nextint(); int l = 0;int r = W;int u = H;int d = 0; int[] x = new int[3*N]; for(int i = 0;i < 3*N;i += 3){ x[i] = sc.nextInt(); x[i+1] = sc.nextInt(); x[i+2] = sc.nextInt(); if(x[i+2] == 1){ if(l <= x[i])l = x[i]; } else if(x[i+2] == 2){ if(x[i] <= r)r = x[i]; } else if(x[i+2] == 3){ if(d <= x[i+1])d = x[i+1]; } else{ if(x[i+1] <= u)u = x[i+1]; } } System.out.println((r-l)*(u-d)); }}
Main.java:7: error: cannot find symbol int N = sc.nextint(); ^ symbol: method nextint() location: variable sc of type Scanner 1 error
s579426835
p03944
C++
#include <algorithm> #include <iostream> using namespace std; int main(){ int W, H, N; cin >> W >> H >> N; int S[H][W], x, y, a, c=0, i, j, k; for(i=0; i<H; i++){ for(j=0; j<W; j++){ S[i][j]=0; } } for(k=0; k<N; k++){ cin >> x >> y >> a; if(a==1){ for(i=0; i<H; i++){ for(j=0; j<x; j++){ S[i][j]=1; } } } else if(a==2){ for(i=0; i<H; i++){ for(j=x; j<W; j++){ S[i][j]=1; } } } else if(a==3){ for(i=0; i<y; i++){ for(j=0; j<W; j++){ S[i][j]=1; } } } else if(a==4){ for(i=y; i<H; i++){ for(j=0; j<W; j++){ S[i][j]=1; } } } for(i=0; i<H; i++){ for(j=0; j<W; j++){ c += S[i][j]; } } cout << c; }
a.cc: In function 'int main()': a.cc:47:2: error: expected '}' at end of input 47 | } | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s216548022
p03944
C++
#include <algorithm> #include <iostream> using namespace std; int main(){ int W, H, N; cin >> W >> H >> N; int S[H][W], x, y, a, c=0, i, j, k; for(i=0; i<H; i++){ for(j=0; j<W; j++){ S[i][j]=0; } } for(k=0; k<N; k++){ cin >> x >> y >> a; if(a==1){ for(i=0; i<H; i++){ for(j=0; j<x; j++){ S[i][j]=1; } } } else if(a==2){ for(i=0; i<H; i++){ for(j=x; j<W; j++){ S[i][j]=1; } } } else if(a==3){ for(i=0; i<y; i++){ for(j=0; j<W; j++){ S[i][j]=1; } } } else if(a==4){ for(i=y; i<H; i++){ for(j=0; j<W; j++){ S[i][j]=1; } } } cout << count(S.begin(), S.end(), '1'); }
a.cc: In function 'int main()': a.cc:41:25: error: request for member 'begin' in 'S', which is of non-class type 'int [H][W]' 41 | cout << count(S.begin(), S.end(), '1'); | ^~~~~ a.cc:41:36: error: request for member 'end' in 'S', which is of non-class type 'int [H][W]' 41 | cout << count(S.begin(), S.end(), '1'); | ^~~ a.cc:42:2: error: expected '}' at end of input 42 | } | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s076689224
p03944
C
#include<stdio.h> int main(){ int l=0,r,u,d=0,n=0; int x,y,a; scanf("%d%d%d",&r,&u,&n); for(int i=0;i<n;i++){ scanf("%d%d%d",&x,&y,&a); switch(a){ case 1: (x<l)?l=x; break; case 2: (r<x)?r=x; break; case 3: (y<d)?d=y; break; case 4: (u<y)?u=y; break; } } if(u>d&&r>l) printf("%d\n",(u-d)*(r-l)); else printf("0\n"); return 0; }
main.c: In function 'main': main.c:10:18: error: expected ':' before ';' token 10 | (x<l)?l=x; | ^ | : main.c:13:18: error: expected ':' before ';' token 13 | (r<x)?r=x; | ^ | : main.c:16:18: error: expected ':' before ';' token 16 | (y<d)?d=y; | ^ | : main.c:19:18: error: expected ':' before ';' token 19 | (u<y)?u=y; | ^ | :
s584043941
p03944
C++
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <iostream> #include <sstream> #include <functional> #include <map> #include <string> #include <cstring> #include <vector> #include <queue> #include <stack> #include <deque> #include <set> #include <list> #include <numeric> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll,ll> P; const double PI = 3.14159265358979323846; const double EPS = 1e-12; const ll INF = 1LL<<29; const ll mod = 1e9+7; #define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i)) #define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d)) #define all(v) (v).begin(), (v).end() #define pb(x) push_back(x) #define mp(x,y) make_pair((x),(y)) #define mset(m,v) memset((m),(v),sizeof(m)) #define chmin(x,y) (x=min(x,y)) #define chmax(x,y) (x=max(x,y)) #define fst first #define snd second #define UNIQUE(x) (x).erase(unique(all(x)),(x).end()) template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;} int main(){ ll lx = 0, ly = 0, rx, ry, n; cin>>rx>>ry>>n; rep(i, n){ ll a, b, c; cin>>a>>b>>c; if(c==1) chmax(lx, a); if(c==2) chmin(rx, a); if(c==3) chmax(ly, b); if(c==4) chmin(ry, b); } chmax(rx, lx); chmax(ry, ly); cout<<(rx-lx)*(ry-ly)<<endl; } return 0; }
a.cc:55:9: error: expected unqualified-id before 'return' 55 | return 0; | ^~~~~~ a.cc:56:1: error: expected declaration before '}' token 56 | } | ^
s012583126
p03944
C++
#include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #define INF 1000000007 using namespace std; int main(){ int X,Y,A; int W1,W2,H1,H2,N; scanf("%d %d %d",&W1,&H1,&N); while(N--){ scanf(" %d %d %d",&X,&Y,&A); if(A==1) W1=max(W1,X); if(A==2) W2=min(W2,X); if(A==3) H1=max(H1,Y); if(A==4) H2=min(H2,Y); } printf("%d\n",(W1<W2&&H1<H2?(W2-W1)*(H2-H1):0)) return 0; }
a.cc: In function 'int main()': a.cc:18:50: error: expected ';' before 'return' 18 | printf("%d\n",(W1<W2&&H1<H2?(W2-W1)*(H2-H1):0)) | ^ | ; 19 | return 0; | ~~~~~~
s563087493
p03944
C++
#include <bits/stdc++.h> const long long MOD = 1000000007; const int INF = INT_MAX / 2; const long double PI = 3.1415926; using namespace std; #define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) #define REP(i, n) FOR(i, (0), n) #define ALL(r) r.begin(), r.end() #define ll long long int typedef vector<ll> vc; typedef vector<string> vcs; typedef vector<pair<ll, ll>> vcp; typedef vector<tuple<ll, ll, ll>> vct; //vector<vector<ll>> vv(n, vector<ll>(n)); typedef int Weight; struct Edge { int from, to; Weight cost; bool operator < (const Edge& e) const { return cost < e.cost; } bool operator >(const Edge& e) const { return cost > e.cost; } }; typedef vector<Edge> Edges; typedef vector<Edges> Graph; void add_edge(Graph &g, int from, int to, Weight cost) { g[from].push_back(Edge{ from, to, cost }); } int main() { ll w, h, n; cin >> w >> h >> n; ll l = 0, r = w, d = 0, u = h; while (n--) { ll a, b, c; cin >> a >> b >> c; if (c == 1) l = max(a, l); else if (c == 2) r = min(a, r); else if (c == 3) d = max(b, d); else u = min(b, u); } cout << max(0, (r - l)*(u - d)) << endl; }
a.cc: In function 'int main()': a.cc:43:20: error: no matching function for call to 'max(int, long long int)' 43 | cout << max(0, (r - l)*(u - d)) << endl; | ~~~^~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:43:20: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 43 | cout << max(0, (r - l)*(u - d)) << endl; | ~~~^~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:43:20: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 43 | cout << max(0, (r - l)*(u - d)) << endl; | ~~~^~~~~~~~~~~~~~~~~~~~
s463753581
p03944
Java
public class Main { static Scanner s = new Scanner(System.in); public static void main(String[] args) { int x,y,a; int left = 0; int under = 0; int width = s.nextInt(); int height = s.nextInt(); int n = s.nextInt(); for (int i = 0; i < n; i++) { x = s.nextInt(); y = s.nextInt(); a = s.nextInt(); switch (a) { case 1: if (left < x) { left = x; } break; case 2: if (width > x) { width = x; } break; case 3: if (under < y) { under = y; } break; case 4: if (height > y) { height = y; } break; } } if (width < left || height < under) { System.out.println(0); } else { System.out.println((width-left) * (height-under)); } } }
Main.java:2: error: cannot find symbol static Scanner s = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:2: error: cannot find symbol static Scanner s = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s237227705
p03944
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int max_x, max_y, num, now_x = 0, now_y = 0, i, ans; int **point, *mode; scanf("%d %d %d", &max_x, &max_y, &num); point = calloc(sizeof(int *), num); mode = calloc(sizeof(int), num); for (i = 0; i < num; i++) { point[i] = calloc(sizeof(int), 2); scanf("%d %d %d", &point[i][0], &point[i][1], &mode[i]); } for (i = 0; i < num; i++) { if (mode[i] == 1) { now_x = now_x < point[i][0] ? point[i][0] : now_x; } else if (mode[i] == 2) { max_x = max_x < point[i][0] ? max_x : point[i][0]; } else if (mode[i] == 3) { now_y = now_y < point[i][1] ? point[i][1] : now_y; } else if (mode[i] == 4) { max_y = max_y < point[i][1] ? max_y : point[i][1]; } } if ((max_x - now_x) < 0 || (max_y - now_y) < 0) { ans = 0; } else { ans = (max_x - now_x) * (max_y - now_y); } printf("%d\n", ans); return 0;
main.c: In function 'main': main.c:38:9: error: expected declaration or statement at end of input 38 | return 0; | ^~~~~~
s833614602
p03944
C++
#include<bits/stdc++.h> using namespace std; int main(){ int w,h,n; cin>>w>>h>>n; int xlow=0,xhigh=w,ylow=0,yhigh=h; for(int i=0;i<n;i++){ int x,y,a; cin>>x>>y>>a; switch(a){ case 1: xlow=max(xlow,x); break; case 2: xhigh=min(xhigh,x); break; case 3: ylow=max(ylow,y); break; case 4: yhigh=min(yhigh,y); break; } } ans=(yhigh-ylow)*(xhigh-xlow); if(yhigh<ylow||xhigh<hlow){ ans=0; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:25:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 25 | ans=(yhigh-ylow)*(xhigh-xlow); | ^~~ | abs a.cc:26:26: error: 'hlow' was not declared in this scope; did you mean 'ylow'? 26 | if(yhigh<ylow||xhigh<hlow){ | ^~~~ | ylow
s626878845
p03944
C
#include <stdio.h> int main(){ int W, H, N, i; int x[101],y[101],a[101]; int ax=W,bx=0,ay=H,by=0; int i; for(i=1;i<=N;i++){ scanf("%d %d %d",&x[i],&y[i],&a[i]); switch(a[i]){ case 1: if(bx<=x[i])bx=x[i]; break; case 2: if(ax>=x[i])ax=x[i]; break; case 3: if(by<=y[i])by=y[i]; break; case 4: if(ay>=y[i])ay=y[i]; break; } } if(bx>=ax || ay<=by){ printf("0"); return 0; } printf("%d",(ax-bx)*(ay-by)); }
main.c: In function 'main': main.c:6:13: error: redeclaration of 'i' with no linkage 6 | int i; | ^ main.c:3:16: note: previous declaration of 'i' with type 'int' 3 | int W, H, N, i; | ^
s377400563
p03944
C++
#include<iostream> using namespace std; int main(){ int W , H , N; cin >> W >> H >> N ; int WWL = 0 , WWR = W , WHU = 0 , WHO = H; for(int i = 0 ; i < N ; i++){ int x , y , a; cin >> x >> y >> a; if( a == 1 ){ WWL = x; }else if(a == 2){ WWR = x; }else if(a == 3){ WHU = y; }else{ WHO = y; } //cout << "xa=" << WWL << " xb=" << WWR << " ya=" << WHU << " yb =" << WHO << endl; } int men = (WWR - WWL) * (WHO - WHU)l; if ((WWR - WWL) < 0 || (WHO - WHU)<0) men = 0; cout << men << endl; return 0; }
a.cc: In function 'int main()': a.cc:26:39: error: expected ',' or ';' before 'l' 26 | int men = (WWR - WWL) * (WHO - WHU)l; | ^
s784706383
p03944
C++
using namespace std; using ll=long long; #include <string> #include <vector> #include <cmath> #include <iostream> int main() { int W, H, N; cin >> W >> H >> N; int minx = 0, miny = 0; for (size_t i = 0; i < N; i++) { int x, y, a; cin >> x >> y >> a; switch (a) { case 1: if (minx < x) minx = x; break; case 2: if (W > x) W = x; break; case 3: if (miny < y) miny = y; break; case 4: if (H > y) H = y; break; default: break; } } int h = (H - miny), w = (W - minx); if (h <= 0 || w <= 0) { cout << "0" << endl; return; } cout << (h*w) << endl; return 0; }
a.cc: In function 'int main()': a.cc:39:17: error: return-statement with no value, in function returning 'int' [-fpermissive] 39 | return; | ^~~~~~
s176049729
p03944
C++
#include "stdafx.h" using namespace std; using ll=long long; #include <string> #include <vector> #include <cmath> #include <iostream> int main() { int W, H, N; cin >> W >> H >> N; int minx = 0, miny = 0; for (size_t i = 0; i < N; i++) { int x, y, a; cin >> x >> y >> a; switch (a) { case 1: if (minx < x) minx = x; break; case 2: if (W > x) W = x; break; case 3: if (miny < y) miny = y; break; case 4: if (H > y) H = y; break; default: break; } } int ans = (W - minx)*(H - miny); if (ans < 0)ans = 0; cout << ans << endl; return 0; }
a.cc:2:10: fatal error: stdafx.h: No such file or directory 2 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s811603565
p03944
C++
#include <iostream> #include <array> #include <string> #include <tuple> #include <vector> using namespace std; using ll = long long; int main() { int W, H, N, x_zero = 0, y_zero = 0; cin >> W >> H >> N; for (size_t i = 0; i < N; i++) { int xi, yi, ai; cin >> xi >> yi >> ai; if (ai == 1 && x_zero < xi) { x_zero = xi; } if (ai == 2 && W > xi) { W = xi; } if (ai == 3 && y_zero < yi) { y_zero = yi; } if (ai == 4 && H > yi) { H = yi; } } int h = H - y_zero, w = W - x_zero; if (h <= 0 || w <= 0){ cout << "0" << endl; return 0}; cout << (h*w) << endl; return 0; }
a.cc: In function 'int main()': a.cc:24:61: error: expected ';' before '}' token 24 | if (h <= 0 || w <= 0){ cout << "0" << endl; return 0}; | ^ | ;
s238119074
p03944
C++
#include <bits/stdc++.h> using namespace std; #define ll long long #define vvi vector< vector<int> > #define vi vector<int> #define All(X) X.begin(),X.end() #define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define REP(i,n) for(int i=0;i<(int)(n);i++) #define pb push_back #define pii pair<int,int> #define mp make_pair #define pi 3.14159265359 #define shosu(X) fixed << setprecision(X) ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} ll lcm(ll a,ll b){return a/gcd(a,b)*b;} int main(){ bool flg[100][100]; REP(i,100) REP(j,100) flg[i][j] = true; int w,h,n; cin >> w >> h >> n; REP(i,n){ int a,x,y; cin >> x >> y >> a; if(a == 1){ REP(i,x) REP(j,h) flg[i][j] = false; }else if(a == 2){ FOR(i,x,w) REP(j,h) flg[i][j] = false; }else if(a == 3){ REP(i,y) REP(j,w) flg[j][i] = false; }else{ FOR(i,y,h) REP(j,w) flg[j][i] = false; } int ans = 0; REP(i,w) REP(j,h) if(flg[i][j]) ans++; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:39:2: error: expected '}' at end of input 39 | } | ^ a.cc:18:11: note: to match this '{' 18 | int main(){ | ^
s330978688
p03944
C
#define SORT(v) sort(v.begin(), v.end()) #include <iostream> #include <vector> #include <queue> #include <stack> #include <map> #include <algorithm> #include <cstdlib> #include <cstdarg> #include <cstdio> #include <cmath> #include <numeric> #include <utility> // #include "ane.cpp" #define INF (int)1e9 #define INFLL (long long)1e18 #define NMAX 102 #define MMAX 100005 #define MOD 100000 using namespace std; // コメントアウトするとdebug()を実行しない #define DEBUG // // ライブラリ // // frequent used aliases typedef long long ll; typedef pair<int, int> p; typedef pair<ll, int> lp; typedef pair<ll, ll> llp; typedef vector<int> vec; typedef vector<vec> mat; // frequent used constants static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1}; static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1}; // デバッグ用printf void debug(const char* format, ...){ #ifndef DEBUG return; #endif va_list arg; va_start(arg, format); vprintf(format, arg); // コンソールに出力 va_end(arg); } // n次元配列の初期化。第2引数の型のサイズごとに初期化していく。 template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ std::fill( (T*)array, (T*)(array+N), val ); } // Union-Find Tree class UnionFindTree{ struct node{ int par; }; std::vector<node> T; public: void init(int num){ T.resize(num+1); // ignore T[0] for (int i = 1; i <= num; ++i) { T[i].par = i; } } void unite(int x, int y){ T[find(y)].par = find(x); } int find(int x){ if (T[x].par == x) return x; else return T[x].par = find(T[x].par); } bool same(int x, int y){ return find(x) == find(y); } }; // Segment Tree for Range Minimum Query // ********************************************************** // *** important: all functions' variable, *** // *** such as "index", "l", "r", etc., must be 0-origin. *** // ********************************************************** // ******************************************** // *** important: NMAX must be power of 2. *** // ******************************************** template<typename T> class SegmentTree{ private: ll N; T INF_VAL; T dat[NMAX * 2]; // 0 origin, A[i] = dat[i + N] T _query(ll l, ll r, ll l_resp, ll r_resp, ll i_dat){ debug("query(%lld, %lld, %lld, %lld, %lld) called\n", l, r, l_resp, r_resp, i_dat); if (r < l_resp || r_resp < l) return INF_VAL; else if(l <= l_resp && r_resp <= r) return dat[i_dat]; else return min(_query(l ,r, l_resp, (l_resp + r_resp) / 2, i_dat * 2), _query(l, r, (l_resp + r_resp) / 2 + 1, r_resp, i_dat * 2 + 1)); } public: void init(ll _N, T _inf_val){ N = 1; while(N < _N) N *= 2; INF_VAL = _inf_val; Fill(dat, _inf_val); } T get(ll index){ return dat[index + N]; } void set(int index, T val){ int i_dat = index + N; dat[i_dat] = val; for (i_dat /= 2; i_dat > 0; i_dat /= 2) { dat[i_dat] = min(dat[i_dat * 2], dat[i_dat * 2 + 1]); } } T query(ll l, ll r){ return _query(l, r, 0, N - 1, 1); } void dump(){ cout << "*** SegTree dump begin ***\n"; cout << "N = " << N << ", INF_VAL = " << INF_VAL << endl; for (int i = 1; i < N * 2; i *= 2) { for (int j = i; j < i * 2; ++j) { if(dat[j] == INF_VAL) cout << "INF "; else cout << dat[j] << " "; } cout << endl; } cout << "*** SegTree dump end ***\n"; } }; // Binary Indexed Tree for Range Sum Query // ******************************************* // *** important: all functions' variable, *** // *** such as "i", must be 1-origin. *** // ******************************************* template<typename T> class BinaryIndexedTree{ private: ll N; T dat[NMAX + 1]; // 1 origin, A[i] = sum(i) - sum(i-1) public: void init(ll _N){ N = _N; Fill(dat, 0); } void add(int i, T val){ while(i <= N) { dat[i] += val; i += i & -i; } } T sum(ll i){ T ret = 0; while(i > 0) { ret += dat[i]; i -= i & -i; // set last HIGH bit to LOW } return ret; } T sum(ll left, ll right){ return sum(right) - sum(left - 1); } void dump(){ cout << "*** BITree dump begin ***\n"; cout << "N = " << N << endl; for (int i = 1; i <= N; i *= 2) { cout << dat[i] << " "; } cout << "*** BITree dump end ***\n"; } }; // // ライブラリ終了 // ll N,M,K,A[NMAX], X[NMAX], Y[NMAX],B,C,D,E, W, H; int dp[NMAX] = {}; ll ans = 0; ll p_left, p_right, top, bottom; void solve(){ // 解答アルゴリズム if (p_left >= p_right || bottom >= top) { ans = 0; return; } else{ ans = (p_right- p_left) * (top - bottom); } } void debug(){ // デバッグ用出力 } void answer(){ // 解答出力 printf("%lld\n", ans); } int main(int argc, char const *argv[]) { // 入力の読み込み,番兵法 // Fill(dp, -1); scanf("%lld%lld%lld", &W, &H, &N); p_right = W; p_left = 0; top = H; bottom = 0; for (int i = 0; i < N; ++i) { scanf("%lld%lld%lld", &X[i], &Y[i], &A[i]); switch(A[i]){ case 1: // p_left p_left = max(p_left, X[i]); break; case 2: // p_right p_right = min(p_right, X[i]); break; case 3: // bottom bottom = max(bottom, Y[i]); break; case 4: // top top = min(top, Y[i]); break; } } solve(); #ifdef DEBUG debug(); #endif answer(); return 0; }
main.c:2:10: fatal error: iostream: No such file or directory 2 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s252602226
p03944
C++
#include<bits/stdc++.h> using namespace std; int b[114][514]; int main(){ int w,h,n; cin>>w>>h>>n; for(int Z=0;Z<n;Z++){ int x,y,a; cin>>x>>y>>a; if(a==1){ for(int i=0;i<x;i++){ for(int j=0;j<h;j++){b[i][j]=1;} } } else if(a==2){ for(int i=x;x<w;x++){ for(int j=0;j<h;j++)b[i][j]=1; } } else if(a==3){ for(int i=0;i<w;i++) for(int j=0;j<y;j++)b[i][j]=1; } else{ for(int i=0;i<w;i++) for(int j=y;j<ha;j++)b[i][j]=1; } } int ans=0; for(int i=0;i<w;i++) for(int j=0;j<h;j++)ans+=b[i][j]; cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:28:39: error: 'ha' was not declared in this scope; did you mean 'a'? 28 | for(int j=y;j<ha;j++)b[i][j]=1; | ^~ | a
s221116548
p03944
C++
#include<bits/stdc++.h> using namespace std; int main(){ int w,h,n; cin>>w>>h>>n; int x,y,a; int b[100][100]={}; int minx=100,my=100; while(1){ if(n==0)break; cin>>x>>y>>a; if(a==1) if(minx>w-x)minx=w-x; else if(a==2) if(minx>x)minx=x; else if(a==3) if(miny>h-y)miny=h-y; else if(a==4) if(miny>y)miny=y; } cout<<minx*miny<<endl; return 0; }
a.cc: In function 'int main()': a.cc:17:7: error: 'miny' was not declared in this scope; did you mean 'minx'? 17 | if(miny>h-y)miny=h-y; | ^~~~ | minx a.cc:21:13: error: 'miny' was not declared in this scope; did you mean 'minx'? 21 | cout<<minx*miny<<endl; | ^~~~ | minx
s656445937
p03944
C++
#include<iostream>   using namespace std;   int main() { int w, h, n, a, b, c, d; cin>>w>>h>>n; a =0, b = w, c =0, d = h; while( n--) { int x, y, m; cin>>x>>y>>m; if( m ==1) a = max( a, x ); if( m ==2) b = min( b, x ); if( m ==3) c = max( c, y ); if( m ==4) d = min( d, y ); } w =(b-a<0?0:b-a); h =(d-c<0?0:d-c); cout<<w*h<<endl; return 0; }
a.cc:2:1: error: extended character   is not valid in an identifier 2 |   | ^ a.cc:4:1: error: extended character   is not valid in an identifier 4 |   | ^ a.cc:2:1: error: '\U000000a0' does not name a type 2 |   | ^ a.cc:4:1: error: '\U000000a0' does not name a type 4 |   | ^
s294637876
p03944
Java
import java.util.Scanner; public class Bquestion { public static void main(String[] args) { int w,h,n; Scanner sc=new Scanner(System.in); w=sc.nextInt(); h=sc.nextInt(); n=sc.nextInt(); int[]x=new int[n]; int[]y=new int[n]; int[]a=new int[n]; for(int i=0;i<n;i++){ x[i]=sc.nextInt(); y[i]=sc.nextInt(); a[i]=sc.nextInt(); } int x_max=w; int x_min=0; int y_max=h; int y_min=0; for(int i=0;i<n;i++){ switch(a[i]){ case 1:x_min=x[i];break; case 2:x_max=x[i];break; case 3:y_min=y[i];break; case 4:y_max=y[i];break; } } if(x_max>x_min && y_max>y_min)System.out.println((x_max-x_min)*(y_max-y_min)); else System.out.println(0); } }
Main.java:2: error: class Bquestion is public, should be declared in a file named Bquestion.java public class Bquestion { ^ 1 error
s704145311
p03944
C++
#include <iostream> #include <vector> #include <set> #include <queue> #include <algorithm> #include <string> #include <cmath> using namespace std; const int INF = 1e9; #define MAX 100 int main(void) { int w, h, n, x, y, a, minx = 0, miny = 0, maxx, maxy; cin >> w >> h >> n; maxx = w; maxy = h; for (int i = 0; i < n; ++i) { cin >> x >> y >> a; switch (a) { case 1: minx = max(minx, x); break; case 2: maxx = min(maxx, x); break; case 3: miny = max(miny, y); break; case 4: maxy = min(maxy, y); break; default: break; } } int a = (maxx - minx) > 0 ? maxx - minx : 0; int b = (maxy - miny) > 0 > maxy - miny : 0; cout << a * b<< endl; return 0; }
a.cc: In function 'int main()': a.cc:37:13: error: redeclaration of 'int a' 37 | int a = (maxx - minx) > 0 ? maxx - minx : 0; | ^ a.cc:12:28: note: 'int a' previously declared here 12 | int w, h, n, x, y, a, minx = 0, miny = 0, maxx, maxy; | ^ a.cc:38:49: error: expected ',' or ';' before ':' token 38 | int b = (maxy - miny) > 0 > maxy - miny : 0; | ^
s375581760
p03944
C++
yutaro at debian in ~/program/atcoder/abc042/A $ ls mainA.cpp yutaro at debian in ~/program/atcoder/abc042/A $ ./a.out 5 5 7 YES yutaro at debian in ~/program/atcoder/abc042/A $ ./a.out 7 7 5 NO yutaro at debian in ~/program/atcoder/abc042/A $ .. yutaro at debian in ~/program/atcoder/abc042 $ B yutaro at debian in ~/program/atcoder/abc042/B $ exe-test ./test1: axxcxxdxx yutaro at debian in ~/program/atcoder/abc042/B $ .. yutaro at debian in ~/program/atcoder/abc042 $ .. yutaro at debian in ~/program/atcoder $ ./mkfile.sh abc043 yutaro at debian in ~/program/atcoder $ cd abc043/ yutaro at debian in ~/program/atcoder/abc043 $ ls A/ B/ C/ D/ yutaro at debian in ~/program/atcoder/abc043 $ A yutaro at debian in ~/program/atcoder/abc043/A $ .. yutaro at debian in ~/program/atcoder/abc043 $ .. yutaro at debian in ~/program/atcoder $ ./mkfile.sh abc047 yutaro at debian in ~/program/atcoder $ cd abc047/ yutaro at debian in ~/program/atcoder/abc047 $ A yutaro at debian in ~/program/atcoder/abc047/A $ exe-test yutaro at debian in ~/program/atcoder/abc047/A $ .. yutaro at debian in ~/program/atcoder/abc047 $ B yutaro at debian in ~/program/atcoder/abc047/B $ exe-test ./test1: 4 ./test2: -3 ./test3: 32 yutaro at debian in ~/program/atcoder/abc047/B $ exe-test ./test1: 4 ./test2: 3 ./test3: 32 yutaro at debian in ~/program/atcoder/abc047/B $ cat test1 5 4 2 2 1 1 3 3 4 yutaro at debian in ~/program/atcoder/abc047/B $ exe-test ./test1: 2,4 0,2 4 ./test2: 2,1 0,3 3 ./test3: 1,9 1,5 32 yutaro at debian in ~/program/atcoder/abc047/B $ exe-test ./test1: 2,5 0,3 9 ./test2: 2,1 0,3 3 ./test3: 1,9 1,9 64 yutaro at debian in ~/program/atcoder/abc047/B $ exe-test ./test1: 2,5 0,3 9 ./test2: 2,1 0,3 0 ./test3: 1,9 1,9 64 yutaro at debian in ~/program/atcoder/abc047/B $
a.cc:2:1: error: 'yutaro' does not name a type 2 | yutaro at debian in ~/program/atcoder/abc042/A | ^~~~~~
s365986801
p03944
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int w,h,n,x,y,a; cin>>w>>h>>n; int xl=0,xr=w,yl=0,yr=h; for(int i=0;i<n;i++){ cin>>x>>y>>a; if(a==1) xl=max(x,xl); else if(a==2) xr=min(x,xr); else if(a==3) yl=max(y,yl); else yr=min(y,yr); } if(xl<xr&&yl<yr) cout<<(xr-xl)*(yr-yl)<<endl; else cout<<0<<endl; return 0; }
a.cc:1:1: error: stray '\177' in program 1 | <U+007F>#include<bits/stdc++.h> | ^~~~~~~~ a.cc:1:2: error: stray '#' in program 1 | #include<bits/stdc++.h> | ^ a.cc:1:3: error: 'include' does not name a type 1 | #include<bits/stdc++.h> | ^~~~~~~ a.cc: In function 'int main()': a.cc:7:3: error: 'cin' was not declared in this scope 7 | cin>>w>>h>>n; | ^~~ a.cc:11:17: error: 'max' was not declared in this scope 11 | if(a==1) xl=max(x,xl); | ^~~ a.cc:12:22: error: 'min' was not declared in this scope; did you mean 'main'? 12 | else if(a==2) xr=min(x,xr); | ^~~ | main a.cc:13:22: error: 'max' was not declared in this scope 13 | else if(a==3) yl=max(y,yl); | ^~~ a.cc:14:14: error: 'min' was not declared in this scope; did you mean 'main'? 14 | else yr=min(y,yr); | ^~~ | main a.cc:16:20: error: 'cout' was not declared in this scope 16 | if(xl<xr&&yl<yr) cout<<(xr-xl)*(yr-yl)<<endl; | ^~~~ a.cc:16:43: error: 'endl' was not declared in this scope 16 | if(xl<xr&&yl<yr) cout<<(xr-xl)*(yr-yl)<<endl; | ^~~~ a.cc:17:8: error: 'cout' was not declared in this scope 17 | else cout<<0<<endl; | ^~~~ a.cc:17:17: error: 'endl' was not declared in this scope 17 | else cout<<0<<endl; | ^~~~
s734400138
p03944
C
#include<stdio.h> int main(){ int W,H,N; scanf("%d",&W); scanf("%d",&H); scanf("%d",&N); int x1=0,x2=W,y1=0,y2=H; int x[N],y[N],a[N]; for(int i=0;i<N;i++){ scanf("%d",&x[i]); scanf("%d",&y[i]); scanf("%d",&a[i]); if(a[i]==1){ if(x1<x[i])x1=x[i]; } else if(a[i]==2){ if(x2>x[i])x2=x[i]; } else if(a[i]==3){ if(y1<y[i])y1=y[i]; } else if(a[i]==4){ if(y2<y[i])y2=y[i]; } } if(x1>x2+1)pritnf("0\n"); else{ printf("%d\n",(x2-x1+2)*(y2-y1+2)); } return 0; }
main.c: In function 'main': main.c:32:16: error: implicit declaration of function 'pritnf'; did you mean 'printf'? [-Wimplicit-function-declaration] 32 | if(x1>x2+1)pritnf("0\n"); | ^~~~~~ | printf
s824653319
p03944
Java
import java.util.Scanner; public class Fill { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int y[] = {0, 0}; int x[] = {0, 0}; x[1] = sc.nextInt(); y[1] = sc.nextInt(); int n = sc.nextInt(); for(int i = 0;i < n;i++){ int x2 = sc.nextInt(); int y2 = sc.nextInt(); int a = sc.nextInt(); if(a == 1 && x[0] < x2)x[0] = x2; else if(a == 2 && x[1] > x2)x[1] = x2; else if(a == 3 && y[0] < y2)y[0] = y2; else if(a == 4 && y[1] > y2)y[1] = y2; } if((x[1]-x[0]) < 0 && (y[1]-y[0]) < 0 )System.out.println(0); else System.out.println((x[1]-x[0])*(y[1]-y[0])); } }
Main.java:3: error: class Fill is public, should be declared in a file named Fill.java public class Fill { ^ 1 error
s554793209
p03944
C
#include <iostream> using namespace std; typedef struct xyz{ int x; int y; int a; }c; int main () { int W,H,N; int i,j,k; int sum = 0; int sum1 = 0; int s[100][100] = {0}; struct xyz c[100] ={0}; /* scanf("%d",&W); scanf("%d",&H); scanf("%d",&N); */ cin >> W >> H >> N; for(i=0;i<N;i++){ /* scanf("%d",&c[i].x); scanf("%d",&c[i].y); scanf("%d",&c[i].a); */ cin >> c[i].x >> c[i].y >> c[i].a; } for(i=0;i<N;i++){ if(c[i].a == 1){ for(j=1;j<=c[i].x;j++){ for(k=1;k<=H;k++){ s[j][k] = 1; } } } if(c[i].a == 2){ for(j=c[i].x +1;j <= W;j++){ for(k=1;k<=H;k++){ s[j][k] = 1; } } } if(c[i].a == 3){ for(j=1;j<=W;j++){ for(k=1;k<=c[i].y ;k++){ s[j][k] = 1; } } } if(c[i].a == 4){ for(j=1;j<=W;j++){ for(k=c[i].y +1 ; k <= H; k++){ s[j][k] = 1; } } } } for(i=1;i<=W;i++){ for(j=1;j<=H;j++){ if(s[i][j] == 0) sum1++; } } if(sum1 > 0){ //printf("%d\n",sum1); cout << sum1 << endl; }else{ //puts("0"); cout << 0 << endl; } return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s501009338
p03944
C
#include<iostream> using namespace std; typedef struct xyz{ int x; int y; int a; }c; int main () { int W,H,N; int i,j,k; int sum = 0; int sum1 = 0; int s[100][100] = {0}; struct xyz c[100] ={0}; /* scanf("%d",&W); scanf("%d",&H); scanf("%d",&N); */ cin >> W >> H >> N; for(i=0;i<N;i++){ /* scanf("%d",&c[i].x); scanf("%d",&c[i].y); scanf("%d",&c[i].a); */ cin >> c[i].x >> c[i].y >> c[i].a; } for(i=0;i<N;i++){ if(c[i].a == 1){ for(j=1;j<=c[i].x;j++){ for(k=1;k<=H;k++){ s[j][k] = 1; } } } if(c[i].a == 2){ for(j=c[i].x +1;j <= W;j++){ for(k=1;k<=H;k++){ s[j][k] = 1; } } } if(c[i].a == 3){ for(j=1;j<=W;j++){ for(k=1;k<=c[i].y ;k++){ s[j][k] = 1; } } } if(c[i].a == 4){ for(j=1;j<=W;j++){ for(k=c[i].y +1 ; k <= H; k++){ s[j][k] = 1; } } } } for(i=1;i<=W;i++){ for(j=1;j<=H;j++){ if(s[i][j] == 0) sum1++; } } if(sum1 > 0){ //printf("%d\n",sum1); cout << sum1 << endl; }else{ //puts("0"); cout << 0 << endl; } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s377840733
p03944
C++
#include<iostream> #include<fstream> #include<string> #include<cmath> using namespace std; int x[100],y[100],a[100] int main(){ int w, h, n int xn,xx,yn,yx,d cin>>w>>h>>n; for(int i=0;i<w;i++){ cin >> x[i]>>y[i]>>a[i]; } for(int i=0,i<w,i++){ if(a[i]==1) xn = max(xn,x[i]); else if(a[i]==2) xx = min(xx,x[i]); } for(int i=0;i<h,i++){ if(a[i]==3) yn = max(yn,y[i]); else if(a[i]==4) yx = min(yx,y[i]); } cout << (xx-xn)*(yx-yn); return 0; };
a.cc:9:1: error: expected initializer before 'int' 9 | int main(){ | ^~~
s836641870
p03944
C++
#include <iostream> #include<math.h> using namespace std; int w,h,n,a,b,c,x1=0,x2,y=0,y2; int main() { cin>>w>>h>>n; x2=w;y2=h; for(int i=0;i<n;i++){ cin>>a>>b>>c; if(c==1)x1=max(a,x1);else if(c==2)x2=min(a,x2);else if(c==3)y=max(b,y);else y2=min(b,y2); } if(x2>x1&&y2>y){ cout<<x2-x1)*(y2-y)<<endl; }else cout<<0<<endl; return 0; }
a.cc: In function 'int main()': a.cc:16:20: error: expected ';' before ')' token 16 | cout<<x2-x1)*(y2-y)<<endl; | ^ | ;
s483258133
p03944
C
#include <stdio.h> int main(void){ int W, H, N; scanf("%d %d %d",&W, &H, &N); int x[N], y[N], a[N]; int i; for(i=0;i<N;i++){ scanf("%d %d %d", &x[i], &y[i], &a[i]); } int w=0,h=0; for(i=0;i<N;i++){ if(a[i]=1){ if(x[i]>=w){ w=x[i]; } }else if(a[i]=2){ if(x[i]<=W){ W=x[i]; } }else if(a[i]=3){ if(y[i]>=h){ h=y[i]; } }else if(a[i]=4){ if(y[i]<=H){ H=y[i]; } } } int ans=0; if(w<W && h<H){ ans=(W-w)*(H-h); } } printf("%d\n", ans); return 0; }
main.c:35:12: error: expected declaration specifiers or '...' before string constant 35 | printf("%d\n", ans); | ^~~~~~ main.c:35:20: error: unknown type name 'ans' 35 | printf("%d\n", ans); | ^~~ main.c:37:5: error: expected identifier or '(' before 'return' 37 | return 0; | ^~~~~~ main.c:38:1: error: expected identifier or '(' before '}' token 38 | } | ^
s727616501
p03944
C
#include <stdio.h> #include <string.h> int main(void){ int W, H, N; scanf("%d%d%d",&W, &H, &N); char x[N], y[N], a[N]; for(int i=0;i<N;i++){ scanf("%s%s%s", &x[i], &y[i], &a[i]); } int w=0,h=0; for(i=0;i<N;i++){ if(a[i]=1){ if(x[i]>w){ w=x[i]; } }else if(a[i]=2){ if(x[i]<W){ W=x[i]; } }else if(a[i]=3){ if(y[i]>h){ h=y[i]; } }else if(a[i]=4){ if(y[i]<H){ H=y[i]; } } } int ans=0; if(w<W){ if(h<H){ ans=(W-w)*(H-h); } } printf("%d", ans); return 0; }
main.c: In function 'main': main.c:11:9: error: 'i' undeclared (first use in this function) 11 | for(i=0;i<N;i++){ | ^ main.c:11:9: note: each undeclared identifier is reported only once for each function it appears in
s996482485
p03944
C++
#include <iostream> #include <fstream> #include <cstdio> #include <cmath> #include <vector> #include <cstring> #include <string> #include <set> #include <map> #include <stack> #include <queue> #include <algorithm> using namespace std; #define REP(i,n) for(int i=0; i<n; ++i) #define FOR(i,a,b) for(int i=a; i<=b; ++i) #define FORR(i,a,b) for (int i=a; i>=b; --i) #define pi acos(-1.0) typedef long long ll; typedef vector<int> VI; typedef vector<ll> VL; typedef vector<VI> VVI; typedef pair<int,int> P; typedef pair<ll,ll> PL; int main(){ int w, h, n; cin >> w >> h >> n; int l = 0, r = w, b = 0, t = h; REP(i,n){ int x, y, a; cin >> x >> y >> a; if (a == 1) l = max(l,x); else if (a == 2) r = min(r,x); else if (a == 3) b = max(b,y); else t = min(t,y); } ans = (r-l)*(t-b); if (l > r || b > t) ans = 0; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:40:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 40 | ans = (r-l)*(t-b); | ^~~ | abs
s926694385
p03944
C++
#include<iostream> #include<algorithm> #include<vector> #include<typeinfo> #include<type_traits> #include<exception> using sll = size_t;//signed long long; struct zxc{ sll x, y; size_t a; zxc(sll x_ = 0, sll y_ = 0, size_t a_ = 0) :x(x_), y(y_), a(a_) {} }; int main() { // std::cout << "size_t:" << typeid(size_t).name() << "\n"; // std::cout << "sll:" << typeid(sll).name() << "\n"; // std::cout <<"decltype(size_t-size_t):"<< typeid(decltype(std::declval<size_t>() - std::declval<size_t>())).name() << "\n"; sll W, H; size_t N; std::cin >> W >> H >> N; //std::vector<zxc> vc; //vc.resize(N); sll x1{0}, y1{ 0 }, x2{ W }, y2{ H }; for (size_t i{ 0 }; i < N; i++) { zxc z; std::cin >> z.x >> z.y >> z.a; if (z.a == 1) { x1 = std::max(x1, z.x); } if (z.a == 2) { x2 = std::min(x2, z.x); } if (z.a == 3) { y1 = std::max(y1, z.y); } if (z.a == 4) { y2 = std::min(y2, z.y); } } sll result = 0; if (( (x2 - x1) > 0) && ( (y2 - y1) > 0)) { result = (x2 - x1)*(y2 - y1); if (result > 100 * 100) { throw(std::exception("DIE")); } } if (result <= 0) { std::cout << 0 << "\n"; } else { std::cout <<result << "\n"; } return 0; } /* 5 4 0 2 1 1 3 3 4 10 10 5 1 6 1 4 1 3 6 9 4 9 4 2 3 1 3 */
a.cc: In function 'int main()': a.cc:54:51: error: no matching function for call to 'std::exception::exception(const char [4])' 54 | throw(std::exception("DIE")); | ^ In file included from /usr/include/c++/14/exception:36, from /usr/include/c++/14/ios:41, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:3: /usr/include/c++/14/bits/exception.h:67:5: note: candidate: 'constexpr std::exception::exception(std::exception&&)' 67 | exception(exception&&) = default; | ^~~~~~~~~ /usr/include/c++/14/bits/exception.h:67:15: note: no known conversion for argument 1 from 'const char [4]' to 'std::exception&&' 67 | exception(exception&&) = default; | ^~~~~~~~~~~ /usr/include/c++/14/bits/exception.h:65:5: note: candidate: 'constexpr std::exception::exception(const std::exception&)' 65 | exception(const exception&) = default; | ^~~~~~~~~ /usr/include/c++/14/bits/exception.h:65:15: note: no known conversion for argument 1 from 'const char [4]' to 'const std::exception&' 65 | exception(const exception&) = default; | ^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/exception.h:62:5: note: candidate: 'std::exception::exception()' 62 | exception() _GLIBCXX_NOTHROW { } | ^~~~~~~~~ /usr/include/c++/14/bits/exception.h:62:5: note: candidate expects 0 arguments, 1 provided
s315970469
p03944
C++
#include<iostream> #include<algorithm> #include<vector> #include<typeinfo> #include<type_traits> using sll = size_t;//signed long long; struct zxc{ sll x, y; size_t a; zxc(sll x_ = 0, sll y_ = 0, size_t a_ = 0) :x(x_), y(y_), a(a_) {} }; int main() { std::cout << "size_t:" << typeid(size_t).name() << "\n"; std::cout << "sll:" << typeid(sll).name() << "\n"; std::cout <<"decltype(size_t-size_t):"<< typeid(decltype(std::declval<size_t>() - std::declval<size_t>())).name() << "\n"; sll W, H; size_t N; std::cin >> W >> H >> N; //std::vector<zxc> vc; //vc.resize(N); sll x1{0}, y1{ 0 }, x2{ W }, y2{ H }; for (size_t i{ 0 }; i < N; i++) { zxc z; std::cin >> z.x >> z.y >> z.a; if (z.a == 1) { x1 = std::max(x1, z.x); } if (z.a == 2) { x2 = std::min(x2, z.x); } if (z.a == 3) { y1 = std::max(y1, z.y); } if (z.a == 4) { y2 = std::min(y2, z.y); } } sll result = 0; if (( (x2 - x1) > 0) && ( (y2 - y1) > 0)) { result = (x2 - x1)*(y2 - y1); if (result > 100 * 100) { throw(std::exception("DIE")); } } if (result <= 0) { std::cout << 0 << "\n"; } else { std::cout <<result << "\n"; } return 0; } /* 5 4 0 2 1 1 3 3 4 10 10 5 1 6 1 4 1 3 6 9 4 9 4 2 3 1 3 */
a.cc: In function 'int main()': a.cc:52:51: error: no matching function for call to 'std::exception::exception(const char [4])' 52 | throw(std::exception("DIE")); | ^ In file included from /usr/include/c++/14/exception:36, from /usr/include/c++/14/ios:41, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:3: /usr/include/c++/14/bits/exception.h:67:5: note: candidate: 'constexpr std::exception::exception(std::exception&&)' 67 | exception(exception&&) = default; | ^~~~~~~~~ /usr/include/c++/14/bits/exception.h:67:15: note: no known conversion for argument 1 from 'const char [4]' to 'std::exception&&' 67 | exception(exception&&) = default; | ^~~~~~~~~~~ /usr/include/c++/14/bits/exception.h:65:5: note: candidate: 'constexpr std::exception::exception(const std::exception&)' 65 | exception(const exception&) = default; | ^~~~~~~~~ /usr/include/c++/14/bits/exception.h:65:15: note: no known conversion for argument 1 from 'const char [4]' to 'const std::exception&' 65 | exception(const exception&) = default; | ^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/exception.h:62:5: note: candidate: 'std::exception::exception()' 62 | exception() _GLIBCXX_NOTHROW { } | ^~~~~~~~~ /usr/include/c++/14/bits/exception.h:62:5: note: candidate expects 0 arguments, 1 provided
s761442977
p03944
C++
#include <stdio.h> int main(){ int w, h, n; int x[101], y[101], a[101]; int xmin, xmax, ymin, ymax; scanf("%d %d %d", &w, &h, &n); for(int i=1; i<n+1, i++){ scanf("%d %d %d", &x[i], &y[i], &a[i]); } xmin =0; ymin=0; xmax=w; ymax=h; for(i=1; i<n+1; i++){ switch(a[i]){ case 1: xmin = x[i]; break; case 2: xmax = x[i]; break; case 3: ymin = y[i]; break; case 4: ymax = y[i]; } } printf("%d\n", (xmax-xmin)*(ymax-ymin)); return 0; }
a.cc: In function 'int main()': a.cc:8:24: error: expected ';' before ')' token 8 | for(int i=1; i<n+1, i++){ | ^ | ; a.cc:16:5: error: 'i' was not declared in this scope 16 | for(i=1; i<n+1; i++){ | ^
s817273037
p03944
C++
#include <stdio.h> int main(){ int w, h, n; int x[101], y[101], a[101]; int xmin, xmax, ymin, ymax; scanf("%d %d %d", &w, &h, &n); for(int i=1; i<n+1, i++){ scanf("%d %d %d", &x[i], &y[i], &a[i]); } xmin =0; ymin=0; xmax=w; ymax=h; for(i=1; i<n+1, i++){ switch(a[i]){ case 1: xmin = x[i]; break; case 2: xmax = x[i]; break; case 3: ymin = y[i]; break; case 4: ymax = y[i]; } } printf("%d\n", (xmax-xmin)*(ymax-ymin)); return 0; }
a.cc: In function 'int main()': a.cc:8:24: error: expected ';' before ')' token 8 | for(int i=1; i<n+1, i++){ | ^ | ; a.cc:16:5: error: 'i' was not declared in this scope 16 | for(i=1; i<n+1, i++){ | ^ a.cc:16:20: error: expected ';' before ')' token 16 | for(i=1; i<n+1, i++){ | ^ | ;
s315672494
p03944
C++
#include <stdio.h> int main(){ int w, h, n; int x[101], y[101], a[101]; int xmin, xmax, ymin, ymax; scanf("%d %d %d", &w, &h, &n); for(int i=1; i<n+1, i++){ scanf("%d %d %d", &x[i], &y[i], &a[i]); } xmin =0; ymin=0; xmax=w; ymax=h; for(int i=1; i<n+1, i++){ switch(a[i]){ case 1: xmin = x[i]; break; case 2: xmax = x[i]; break; case 3: ymin = y[i]; break; case 4: ymax = y[i]; } } printf("%d\n", (xmax-xmin)*(ymax-ymin)); return 0; }
a.cc: In function 'int main()': a.cc:8:24: error: expected ';' before ')' token 8 | for(int i=1; i<n+1, i++){ | ^ | ; a.cc:16:24: error: expected ';' before ')' token 16 | for(int i=1; i<n+1, i++){ | ^ | ;
s085544027
p03944
Java
import java.util.*; public class Main public static void main(String[] args) { Scanner sc = new Scanner(System.in); int W = sc.nextInt(); int H = sc.nextInt(); int N = sc.nextInt(); int[] x = new int[N]; int[] y = new int[N]; int[] a = new int[N]; int xmin = 0; int xmax = W; int ymin = 0; int ymax = H; for (int i = 0; i < N; ++i) { x[i] = sc.nextInt(); y[i] = sc.nextInt(); a[i] = sc.nextInt(); if (a[i] == 1) { xmin = Math.max(xmin, x[i]); } else if (a[i] == 2) { xmax = Math.min(xmax, x[i]); } else if (a[i] == 3) { ymin = Math.max(ymin, y[i]); } else if (a[i] == 4) { ymax = Math.min(ymax, y[i]); } } if (xmax > xmin && ymax > ymin) System.out.println((xmax - xmin) * (ymax - ymin)); else { System.out.println(0); } } }
Main.java:3: error: '{' expected public class Main ^ Main.java:4: error: unnamed classes are a preview feature and are disabled by default. public static void main(String[] args) { ^ (use --enable-preview to enable unnamed classes) Main.java:37: error: class, interface, enum, or record expected } ^ 3 errors
s888362031
p03944
C++
#include <iostream> #include <algorithm> using namespace std; int main() { int W, H, N; cin >> W >> H >> N; int point[N][3]; for (int i = 0; i < N; i++){ for (int j = 0; j < 3; j++) { cin >> point[i][j]; } } int dl[2] = {0, 0}; int ur[2] = {W, H}; for (int i = 0; i < N; i++) { switch (point[i][2]) { case 1: dl[0] = max(dl[0],point[i][0]); break; case 2: ur[0] = min(ur[0],point[i][0]); break; case 3: dl[1] = max(mh[1], point[i][1]); break; case 4: ur[1] = min(ur[1], point[i][1]); break; } } if ((ur[0] - dl[0]) * (ur[1] - dl[1]) > 0) { cout << (ur[0] - dl[0]) * (ur[1] - dl[1]) << endl; } else { cout << 0 << endl; } return 0; }
a.cc: In function 'int main()': a.cc:27:29: error: 'mh' was not declared in this scope 27 | dl[1] = max(mh[1], point[i][1]); | ^~
s362004414
p03944
C++
#include <iostream> using namespace std; int main() { int W, H, N; cin >> W >> H >> N; int point[N][3]; for (int i = 0; i < N; i++){ for (int j = 0; j < 3; j++) { cin >> point[i][j]; } } int dl[2] = {0, 0}; int ur[2] = {W, H}; for (int i = 0; i < N; i++) { switch (point[i][2]) { case 1: dl[0] = max(dl[0],point[i][0]); break; case 2: ur[0] = min(ur[0],point[i][0]); break; case 3: dl[1] = max(mh[1], point[i][1]); break; case 4: ur[1] = min(ur[1], point[i][1]); break; } } if ((ur[0] - dl[0]) * (ur[1] - dl[1]) > 0) { cout << (ur[0] - dl[0]) * (ur[1] - dl[1]) << endl; } else { cout << 0 << endl; } return 0; }
a.cc: In function 'int main()': a.cc:26:29: error: 'mh' was not declared in this scope 26 | dl[1] = max(mh[1], point[i][1]); | ^~
s731446827
p03944
C++
#include <bits/stdc++.h> using namespace std; int xy[101][101],W,H,N; int main(){ scanf("%d %d %d",&W,&H,&N); int x,y,a; for(int i=0;i<N;i++){ scanf("%d %d %d",&x,&y,&a); switch (a) { case 1:for(int j=0;j<x;j++){ for(int k=0;k<H;k++){ xy[j][k]=1; } } break; case 2:for(int j=x;j<W;j++){ for(int k=0;k<H;k++){ xy[j][k]=1; } } break; case 3:for(int j=0;j<y;j++){ for(int k=0;k<W;k++){ xy[k][j]=1; } } break; case 4:for(int j=y;j<H;j++){ for(int k=0;k<W;k++){ xy[k][j]=1; } } break; default: break; } } for(int i=0;i<H;i++){ int cnt=0; for(int j=0;j<W;j++){ if(xy[j][i]==0) cnt++; } maxW=max(cnt,maxW); } for(int i=0;i<W;i++){ int cnt=0; for(int j=0;j<H;j++){ if(xy[i][j]==0) cnt++; } maxH=max(cnt,maxH); } int S=(maxH)*(maxW); //check_s //printf("%d %d\n",maxH,maxW); //check_e printf("%d",S); return 0; }
a.cc: In function 'int main()': a.cc:48:5: error: 'maxW' was not declared in this scope 48 | maxW=max(cnt,maxW); | ^~~~ a.cc:57:5: error: 'maxH' was not declared in this scope 57 | maxH=max(cnt,maxH); | ^~~~ a.cc:61:10: error: 'maxH' was not declared in this scope 61 | int S=(maxH)*(maxW); | ^~~~ a.cc:61:17: error: 'maxW' was not declared in this scope 61 | int S=(maxH)*(maxW); | ^~~~
s476035238
p03944
C++
#include <bits/stdc++.h> using namespace std; int xy[101][101],W,H,N; int main(){ scanf("%d %d %d",&W,&H,&N); int x,y,a; for(int i=0;i<N;i++){ scanf("%d %d %d",&x,&y,&a); switch (a) { case 1:for(int j=0;j<x;j++){ for(int k=0;k<H;k++){ xy[j][k]=1; } } break; case 2:for(int j=x;j<W;j++){ for(int k=0;k<H;k++){ xy[j][k]=1; } } break; case 3:for(int j=0;j<y;j++){ for(int k=0;k<W;k++){ xy[k][j]=1; } } break; case 4:for(int j=y;j<H;j++){ for(int k=0;k<W;k++){ xy[k][j]=1; } } break; default: break; } } for(int i=0;i<H;i++){ for(int j=0;j<W;j++){ if(xy[j][i]==0) cnt++; } maxW=max(cnt,maxW); } for(int i=0;i<W;i++){ for(int j=0;j<H;j++){ if(xy[i][j]==0) cnt++; } maxH=max(cnt,maxH); } int S=(maxH)*(maxW); //check_s //printf("%d %d\n",maxH,maxW); //check_e printf("%d",S); return 0; }
a.cc: In function 'int main()': a.cc:46:23: error: 'cnt' was not declared in this scope; did you mean 'int'? 46 | if(xy[j][i]==0) cnt++; | ^~~ | int a.cc:48:5: error: 'maxW' was not declared in this scope 48 | maxW=max(cnt,maxW); | ^~~~ a.cc:48:14: error: 'cnt' was not declared in this scope; did you mean 'int'? 48 | maxW=max(cnt,maxW); | ^~~ | int a.cc:55:23: error: 'cnt' was not declared in this scope; did you mean 'int'? 55 | if(xy[i][j]==0) cnt++; | ^~~ | int a.cc:57:5: error: 'maxH' was not declared in this scope 57 | maxH=max(cnt,maxH); | ^~~~ a.cc:57:14: error: 'cnt' was not declared in this scope; did you mean 'int'? 57 | maxH=max(cnt,maxH); | ^~~ | int a.cc:61:10: error: 'maxH' was not declared in this scope 61 | int S=(maxH)*(maxW); | ^~~~ a.cc:61:17: error: 'maxW' was not declared in this scope 61 | int S=(maxH)*(maxW); | ^~~~
s728623629
p03944
C
#include<stdio.h> int main(){ int i,a,b,c; int a1[100]; int b1[100]; int c1; scanf("%d %d %d",&a,&b,&c); int total=a*b; for(i=0;i<c;i++){ scanf("%d %d %d",&a1[i],&b1[i],&c1); if(c1==1){ total=total-(a[i]+a[i-1]+a[i-2])*b; } if(c1==2){ total=total-(a-a1[i]+a[i-1]+a[i-2])*b; a=a1; } if(c1==3){ total=total-b1[i]-b[i-1]-b[-2]*a;; } if(c1==4){ total=total-(b-b1[i]-b[i-1]+b[i-2})*a; } } printf("%d\n",total); }
main.c: In function 'main': main.c:12:39: error: subscripted value is neither array nor pointer nor vector 12 | total=total-(a[i]+a[i-1]+a[i-2])*b; | ^ main.c:12:44: error: subscripted value is neither array nor pointer nor vector 12 | total=total-(a[i]+a[i-1]+a[i-2])*b; | ^ main.c:12:51: error: subscripted value is neither array nor pointer nor vector 12 | total=total-(a[i]+a[i-1]+a[i-2])*b; | ^ main.c:15:47: error: subscripted value is neither array nor pointer nor vector 15 | total=total-(a-a1[i]+a[i-1]+a[i-2])*b; | ^ main.c:15:54: error: subscripted value is neither array nor pointer nor vector 15 | total=total-(a-a1[i]+a[i-1]+a[i-2])*b; | ^ main.c:16:18: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion] 16 | a=a1; | ^ main.c:19:52: error: subscripted value is neither array nor pointer nor vector 19 | total=total-b1[i]-b[i-1]-b[-2]*a;; | ^ main.c:19:59: error: subscripted value is neither array nor pointer nor vector 19 | total=total-b1[i]-b[i-1]-b[-2]*a;; | ^ main.c:22:55: error: subscripted value is neither array nor pointer nor vector 22 | total=total-(b-b1[i]-b[i-1]+b[i-2})*a; | ^ main.c:22:62: error: subscripted value is neither array nor pointer nor vector 22 | total=total-(b-b1[i]-b[i-1]+b[i-2})*a; | ^ main.c:22:66: error: expected ']' before '}' token 22 | total=total-(b-b1[i]-b[i-1]+b[i-2})*a; | ^ | ] main.c:22:66: error: expected ')' before '}' token 22 | total=total-(b-b1[i]-b[i-1]+b[i-2})*a; | ~ ^ | ) main.c:22:66: error: expected ';' before '}' token 22 | total=total-(b-b1[i]-b[i-1]+b[i-2})*a; | ^ | ; main.c:22:67: error: expected statement before ')' token 22 | total=total-(b-b1[i]-b[i-1]+b[i-2})*a; | ^ main.c:22:68: error: invalid type argument of unary '*' (have 'int') 22 | total=total-(b-b1[i]-b[i-1]+b[i-2})*a; | ^~ main.c: At top level: main.c:25:32: error: expected declaration specifiers or '...' before string constant 25 | printf("%d\n",total); | ^~~~~~ main.c:25:39: error: unknown type name 'total' 25 | printf("%d\n",total); | ^~~~~ main.c:26:17: error: expected identifier or '(' before '}' token 26 | } | ^
s363480636
p03944
C++
#include <algorithm>//min/max/sort(rand-access it)/merge #include <array> #include <bitset> // #include <chrono>//std::chrono::/system_clock/steady_clock/high_resolution_clock/duration #include <climits>//INT_MAX/INT_MIN/ULLONG_MAX #include <cmath>//fmin/fmax/fabs/sin(h)/cos(h)/tan(h)/exp/log/pow/sqrt/cbrt/ceil/floor/round/trunc #include <cstdlib>//abs/atof/atoi/atol/atoll/strtod/strtof/..., srand/rand, calloc/malloc, exit, qsort // #include <fstream>//ifstream/ofstream #include <iomanip>//setfill/setw/setprecision/fixed/scientific #include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific #include <iterator> #include <limits>//numeric_limits<type>::max/min/lowest/epsilon/infinity/quiet_NaN/signaling_NaN #include <list> #include <queue> #include <string>//stoi/stol/stoul/stoll/stoull/stof/stod/stold/to_string/getline #include <tuple> #include <utility>//pair #include <valarray> #include <vector> #define PRIME_SHORT 10007 #define PRIME 1000000007 using namespace std; typedef unsigned int ui; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, int> plli; typedef pair<ull, int> puli; typedef pair<double, int> pdi; typedef pair<ll, ll> pllll; typedef pair<ull, ull> pulul; typedef pair<double, double> pdd; typedef tuple<int, int, int> ti3; typedef tuple<int, int, int, int> ti4; const bool debug = false; template<typename T> void rar(size_t n, T* a); template<typename T> void rar2(size_t n, size_t m, T** a); template<typename T> T ipow(T base, T exp); inline size_t left(size_t current, bool swap); inline size_t right(size_t current, bool swap); template<typename T> inline T griddist(T x, T y, T s, T t); template<typename T> inline T griddist(pair<T, T> one, pair<T, T> two); template<typename T> inline T griddist(tuple<T, T> one, tuple<T, T> two); template<typename T> inline T sqeucldist(T x, T y, T s, T t); template<typename T> inline T sqeucldist(pair<T, T> one, pair<T, T> two); template<typename T> inline T sqeucldist(tuple<T, T> one, tuple<T, T> two); inline ull modadd(ull a, ull b, int mod); inline ull modmult(ull a, ull b, int mod); int main(void) { int w, h; cin >> w >> h; int n; cin >> n; int left, right, top, bottom; left = top = 0; right = w; bottom = h; for (size_t i = 0; i < n; ++i) { int x, y, a; cin >> x >> y >> a; switch(a) { case 1: { if (left < x) left = x; break; } case 2: { if (right > x) right = x; break; } case 3: { if (bottom > x) bottom = x; break; } case 4: { if (top < x) top = x; break; } } long long area = (bottom-top)*(right-left); cout << (area > 0 ? area : 0) << endl; return 0; } int m; cin >> m; char p; cin >> p; char q; cin >> q; char r; cin >> r; string s; cin >> s; string t; cin >> t; int* arr = new int[n]; rar(n, arr); int** rra = new int*[n]; rar2(n, n, rra); //debug output if (debug) { //1D cout << "arr" << endl; for (int i = 0; i < n; ++i) { cout << arr[i] << "\t"; } //2D cout << "\nrra" << endl; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { cout << rra[i][j] << "\t"; } cout << endl; } } return 0; }
/usr/bin/ld: /tmp/cctJMARc.o: in function `main': a.cc:(.text+0x278): undefined reference to `void rar<int>(unsigned long, int*)' /usr/bin/ld: a.cc:(.text+0x2bd): undefined reference to `void rar2<int>(unsigned long, unsigned long, int**)' collect2: error: ld returned 1 exit status
s338245884
p03944
C++
#include<bits/stdc++.h> using namespace std; struct Corner{ double x,y; }; const int MAX_N=100; double x[MAX_N+1],y[MAX_N+1],a[MAX_N+1]; int main(){ double w,h; int n; double wide,height; cin>>w>>h>>n; Corner co[2][2]; co[0][0].x=0; co[0][0].y=0; co[0][1].x=0; co[0][1].y=h; co[1][1].x=w; co[1][1].y=h; co[1][0].x=w; co[1][0].y=0; for(int i=0; i<n; i++){ cin>>x[i]>>y[i]>>a[i]; if(a[i]==1){ co[0][0].x=x[i]; co[0][1].x=x[i]; } if(a[i]==2){ co[1][1].x=x[i]; co[1][0].x=x[i]; } if(a[i]==3){ co[0][0].y=y[i]; co[1][0].y=y[i]; } if(a[i]==4){ co[1][1].y=y[i]; co[0][1].y=y[i]; } } wide=co[1][0].x-co[0][0].x; height=co[0][1].y-co[0][0].y; if(wide=<0||height=<0){ cout<<0<<endl; }else{ cout<<wide*height<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:47:13: error: expected primary-expression before '<' token 47 | if(wide=<0||height=<0){ | ^ a.cc:47:24: error: expected primary-expression before '<' token 47 | if(wide=<0||height=<0){ | ^
s212995267
p03944
C++
#include<bits/stdc++.h> using namespace std; struct Corner{ double x,y; }; const int MAX_N=100; double x[MAX_N+1],y[MAX_N+1],a[MAX_N+1]; int main(){ double w,h; int n; double wide,height; cin>>w>>h>>n; Corner co[2][2]; co[0][0].x=0; co[0][0].y=0; co[0][1].x=0; co[0][1].y=h; co[1][1].x=w; co[1][1].y=h; co[1][0].x=w; co[1][0].y=0; for(int i=0; i<n; i++){ cin>>x[i]>>y[i]>>a[i]; if(a[i]==1){ co[0][0].x=x[i]; co[0][1].x=x[i]; } if(a[i]==2){ co[1][1].x=x[i]; co[1][0].x=x[i]; } if(a[i]==3){ co[0][0].y=y[i]; co[1][0].y=y[i]; } if(a[i]==4){ co[1][1].y=y[i]; co[0][1].y=y[i]; } } wide=co[1][0].x-co[0][0].x; height=co[0][1].y-co[0][0].y; if(wide=<0||height=<0){ cout<<0<<endl; }else{ cout<<wide*height<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:47:13: error: expected primary-expression before '<' token 47 | if(wide=<0||height=<0){ | ^ a.cc:47:24: error: expected primary-expression before '<' token 47 | if(wide=<0||height=<0){ | ^
s792595876
p03944
Java
import java.util.Arrays; import java.util.Scanner; public class B { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int W = Integer.parseInt(scan.next()); int H = Integer.parseInt(scan.next()); int N = Integer.parseInt(scan.next()); int[] xs = new int[N]; int[] ys = new int[N]; int[] as = new int[N]; for(int n=0;n<N;n++){ xs[n] = Integer.parseInt(scan.next()); ys[n] = Integer.parseInt(scan.next()); as[n] = Integer.parseInt(scan.next()); } scan.close(); int[] impoint = new int[4]; impoint[0] = 0; impoint[1] = W; impoint[2] = 0; impoint[3] = H; for(int i=0;i<N;i++){ switch (as[i]){ case 1: //left if(xs[i] > impoint[0]){ impoint[0] = xs[i]; } break; case 2://right if(xs[i] < impoint[1]){ impoint[1] = xs[i]; } break; case 3://down if(ys[i] > impoint[2]){ impoint[2] = ys[i]; } break; case 4://up if(ys[i] < impoint[3]){ impoint[3] = ys[i]; } break; } } System.out.println(Math.max((impoint[1] - impoint[0]) * (impoint[3] - impoint[2]),0)); } }
Main.java:4: error: class B is public, should be declared in a file named B.java public class B { ^ 1 error
s639846811
p03944
C++
#include <iostream> #include <vector> #include <stack> #include <queue> #include <list> #include <functional> #include <algorithm> #include <complex> #include <map> #include <cmath> #include <string> #include <cstdio> #include <stdio.h> #include <cstdlib> #include <istream> using namespace std; //--------------------------------------------------------------// int w, h, n, x[100], y[100], a[100],b,c,d,q,e; int s3,s4; stack<int> s1; stack<int> s2; int main() { cin >> w >> h >> n; for (int i = 0; i < n; i++) { cin >> x[i] >> y[i] >> a[i]; } for (int j = 0; j < n; j++) { b = a[j]; q = x[j]; e = y[j]; if (b == 1 && q < w) { c = w - q; s1.push(c); } else if (b == 2 && q < w) { c = q; s1.push(c); } else if (b == 3 && e < h) { d = h - e; s2.push(d); } else if (b == 4 && e < h) { d = e; s2.push(d); } else { cout << 0 << endl; return 0; } } if (s1.size > 1) { for (int i = 0; i < s1.size; i++) { s3 = s1.top(); s1.pop(); s4 = s1.top(); s1.pop(); s1.push(min(s3, s4)); } } if(s2.size > 1) { for (int j = 0; j < s2.size; j++) { s3 = s2.top(); s2.pop(); s4 = s2.top(); s2.pop(); s2.push(min(s3, s4)); } } s3 = s1.top(); s4 = s2.top(); cout << s3*s4 << endl; }
a.cc: In function 'int main()': a.cc:56:16: error: invalid use of member function 'std::stack<_Tp, _Sequence>::size_type std::stack<_Tp, _Sequence>::size() const [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; size_type = long unsigned int]' (did you forget the '()' ?) 56 | if (s1.size > 1) { | ~~~^~~~ | () a.cc:57:40: error: invalid use of member function 'std::stack<_Tp, _Sequence>::size_type std::stack<_Tp, _Sequence>::size() const [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; size_type = long unsigned int]' (did you forget the '()' ?) 57 | for (int i = 0; i < s1.size; i++) { | ~~~^~~~ | () a.cc:63:23: error: invalid use of member function 'std::stack<_Tp, _Sequence>::size_type std::stack<_Tp, _Sequence>::size() const [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; size_type = long unsigned int]' (did you forget the '()' ?) 63 | if(s2.size > 1) { | ~~~^~~~ | () a.cc:64:48: error: invalid use of member function 'std::stack<_Tp, _Sequence>::size_type std::stack<_Tp, _Sequence>::size() const [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; size_type = long unsigned int]' (did you forget the '()' ?) 64 | for (int j = 0; j < s2.size; j++) { | ~~~^~~~ | ()
s014982718
p03944
C++
#include <iostream> #include <vector> using namespace std; int main(int argc, char const* argv[]){ int w,h,n;cin>>w>>h>>n; vector<int> x(n),y(n),a(n); for (int i = 0; i < n; i++) { cin>>x[i]>>y[i]>>a[i]; } int xi=0,xj=w,yi=0,yj=h; for (int i = 0; i < n; i++) { if(a[i] == 1){ xi = x[i]; }else if (a[i] == 2) { xj = x[i]; }else if (a[i] == 3){ yi = y[i]; }else if (a[i] == 4){ yj = y[i]; } } if(xj<xi || yj<yi || w < xj-xi || h < yj-ji)cout<<"0"<<endl; else cout << (xj-xi) * (yj-yi) << endl; }
a.cc: In function 'int main(int, const char**)': a.cc:24:46: error: 'ji' was not declared in this scope; did you mean 'yi'? 24 | if(xj<xi || yj<yi || w < xj-xi || h < yj-ji)cout<<"0"<<endl; | ^~ | yi
s338027742
p03944
C
#include <iostream> #include <cmath> #include <cstdio> #include <vector> #include <string> using namespace std; int main() { long long width, height, N; //int width_a = 0, height_a = 0; long long uplimit; long long lowlimit = 0; long long rightlimit; long long leftlimit = 0; long long S; long long x[101], y[101], a[101]; cin >> width >> height >> N; uplimit = height; rightlimit = width; for (int i = 0; i < N; i++) { cin >> x[i] >> y[i] >> a[i]; } for (int i = 0; i < N; i++) { if (a[i]==1 && leftlimit < x[i]) { leftlimit = x[i]; } else if (a[i] == 2 && rightlimit > x[i]) { rightlimit = x[i]; } else if (a[i] == 3 && lowlimit < y[i]) { lowlimit = y[i]; } else if (a[i] == 4 && uplimit > y[i]) { uplimit = y[i]; } } if ((uplimit - lowlimit)*(rightlimit - leftlimit) <= 0 ||uplimit<0||lowlimit>height||rightlimit<0||leftlimit>width ) { S = 0; } else { S = (uplimit - lowlimit)*(rightlimit - leftlimit); } cout << S << endl; return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s591041881
p03944
C
#include <stdio.h> int main () { int W, H, N; scanf("%d %d %d", &W, &H, &N); int map[100][100] = {}; int i, j; for (i=0; i<H; i++) { for (j=0; j<W; j++) { map[i][j] = 1; } } int w, h, a; int x, y; for (i=0; i<N; i++) { scanf("%d %d %d", &w, &h, &a); switch (a) { case 1: for (y=0; y<H; y++) { for (x=0; x<w; x++) { map[y][x] = 0; } } break; case 2: for (y=0; y<H; y++) { for (x=W; x>=w; x--) { map[y][x] = 0; } } break; case 3: for (y=0; y<h; y++) { for (x=0; x<W; x++) { map[y][x] = 0; } } break; case 4: for (y=H; y>h; y--) { for (x=0; x=<W; x++) { map[y][x] = 0; } } break; } } int result = 0; for(y=0; y<H; y++) { for(x=0; x<W; x++) { if (map[x][y] == 1) result++; } } printf("%d\n", result); return 0; }
main.c: In function 'main': main.c:55:21: error: expected expression before '<' token 55 | for (x=0; x=<W; x++) { | ^
s268679067
p03944
C
#include <stdio.h> int main(){ int W,H,N; scanf("%d %d %d",&W,&H,&N); int x[N],y[N],a[N],i; for(i=0;i<N;i++){ scanf("%d %d %d",&x[i],&y[i],&a[i]); } int xl=0,xr=W,yu=H,yl=0; for(i=0;i<N;i++){ if(a[i]==1) if(xl<x[i]) xl=x[i]; if(a[i]==2) if(xr>x[i]) xr=x[i]; if(a[i]==3) if(yl<y[i]) yl=y[i]; if(a[i]==4) if(yu>y[i]) yu=y[i]; } int sum=(xr-xl)*(yu-yl); if((xr-xl)>0&(yr-yl)>0) printf("%d\n",sum); else printf("0\n"); return 0; }
main.c: In function 'main': main.c:34:23: error: 'yr' undeclared (first use in this function); did you mean 'yl'? 34 | if((xr-xl)>0&(yr-yl)>0) | ^~ | yl main.c:34:23: note: each undeclared identifier is reported only once for each function it appears in
s851525591
p03944
Java
import java.util.Scanner; public class MissionB { public static void main(String[] args) { //変数// int W; //右上頂点x座標 int H; //右上頂点y座標 int N; //長方形内の点の個数 int minwx; //白い部分のx座標始まり int maxwx; //白い部分のx座標終わり int minwy; //白い部分のy座標始まり int maxwy; //白い部分のy座標終わり int warea; //白い部分の面積 int[] x; //点のx座標 int[] y; //点のy座標 int[] a; //指定範囲ルールナンバー Scanner scan = new Scanner(System.in); //入力// W = scan.nextInt(); H = scan.nextInt(); N = scan.nextInt(); x = new int[N]; y = new int[N]; a = new int[N]; for(int i = 0; i < N; i++){ x[i] = scan.nextInt(); y[i] = scan.nextInt(); a[i] = scan.nextInt(); } scan.close(); //処理// //初期処理 minwx = 0; maxwx = W; minwy = 0; maxwy = H; //ルールナンバーごとに処理 for(int j = 0; j < N; j++){ if( a[j] == 1 && minwx < x[j] ){ minwx = x[j]; }else if( a[j] == 2 && maxwx > x[j] ){ maxwx = x[j]; }else if( a[j] == 3 && minwy < y[j] ){ minwy = y[j]; }else if( a[j] == 4 && maxwy > y[j] ){ maxwy = y[j]; } } //白い部分が残っているかどうか判定 if( minwx >= maxwx || minwy >= maxwy ){ warea = 0; }else{ warea = (maxwx - minwx) * (maxwy - minwy); } //結果// System.out.println(warea); } }
Main.java:3: error: class MissionB is public, should be declared in a file named MissionB.java public class MissionB { ^ 1 error
s245745273
p03944
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); // 整数の入力 int w = sc.nextInt(); // スペース区切りの整数の入力 int h = sc.nextInt(); int n = sc.nextInt(); // 文字列の入力 int x[] = new int[n]; int y[] = new int[n]; int a[] = new int[n]; int maxx = w; int maxy = h; int minx = 0; int miny = 0; for(int i=0; i++; i<n){ x[i] = sc.nextInt(); y[i] = sc.nextInt(); a[i] = sc.nextInt(); switch (a[i]){ case 1: if(minx > x[i]){ minx = x[i]; } break; case 2: if(maxx < x[i]){ maxx = x[i]; } break; case 3: if(miny > y[i]){ miny = y[i]; } break; case 4: if(maxy < y[i]){ maxy = y[i]; } break; } } int answer = (maxx - minx) * (maxy - miny); System.out.println(answer); } }
Main.java:18: error: not a statement for(int i=0; i++; i<n){ ^ 1 error