submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s545213131 | p02245 | C++ | #include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 3
#define N2 9
struct Puzzle {
int f[N2];
int space;
string path;
bool operator < (const Puzzle& p) const {
for (int i = 0; i < N2; i++) {
if (f[i] == p.f[i]) {
continue;
... | a.cc: In function 'std::string bfs(Puzzle)':
a.cc:59:37: error: expected primary-expression before '||' token
59 | if (tx < 0 || ty < 0 || tx >= || ty >= N) {
| ^~
|
s135611166 | p02246 | Java | import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;
import java.util.HashSet;
public class FifteenPuzzleAstar {
public static void main(String[] args) throws Exception {
new FifteenPuzzleAstar();
}
//4方向探索用
static final int[] dx = { 0, 1, 0, -1};
static final int... | Main.java:6: error: class FifteenPuzzleAstar is public, should be declared in a file named FifteenPuzzleAstar.java
public class FifteenPuzzleAstar {
^
1 error
|
s756501570 | p02246 | Java | import java.util.HashMap;
import java.util.Scanner;
private static int n;
private static int limit;
private static String ans;
private static final int[] d = {4, -4, -1, 1};
private static HashMap<String, Integer> hm;
public class Main {
public static void main(String[] args) {
... | Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
private static int n;
^
(use --enable-preview to enable unnamed classes)
1 error
|
s231732900 | p02246 | Java | import java.util.HashMap;
import java.util.Scanner;
public static int n;
public static int limit;
public static String ans;
public static final int[] d = {4, -4, -1, 1};
public static HashMap<String, Integer> hm;
public class Main {
public static void main(String[] args) {
... | Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
public static int n;
^
(use --enable-preview to enable unnamed classes)
1 error
|
s036488647 | p02246 | C | #include <stdio.h>
#include <stdlib.h>
// I/O
int get_uint() {
int n = 0;
int c = getchar_unlocked();
if(c < 48 || 57 < c) return c;
while(47 < c && c < 58) n = 10 * n + (c & 0xf), c = getchar_unlocked();
return n;
}
void put_uint(int n) {
if(!n) {
putchar_unlocked('0');
return;... | main.c: In function 'main':
main.c:84:14: error: implicit declaration of function 'interative_deepening'; did you mean 'iterative_deepening'? [-Wimplicit-function-declaration]
84 | put_uint(interative_deepening(&initial));
| ^~~~~~~~~~~~~~~~~~~~
| iterative_deepening
|
s025169944 | p02246 | C | #include <stdio.h>
#include <math.h>
#define N 4
int search(int board[N][N], int min, int limit, int r_0, int c_0, char mv)
{
int md_c[4];
int op[4], num[4];
int res[4];
int i;
char dir[5] = "nswe";
if (min == 0) return 0;
for (i = 0; i < 4; i++) {
md_c[i] = min;
res[i] = -1;
}
op[0] = r_0-1;... | main.c:151:5: error: redefinition of 'search'
151 | int search(int board[N][N], int min, int limit, int r_0, int c_0, char mv)
| ^~~~~~
main.c:5:5: note: previous definition of 'search' with type 'int(int (*)[4], int, int, int, int, char)'
5 | int search(int board[N][N], int min, int limit, int r_0,... |
s639608372 | p02246 | C | #include <stdio.h>
#include <string.h>
#include <math.h>
#define N 4
#define N2 16
#define LIM 100
static const int dx[N] = {0, -1, 0, 1};
static const int dy[N] = {1, 0, -1, 0};
static const char dir[N] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];
typedef struct{
int f[N2];
int space;
int md;
}Puzzle;
Puzzle sta... | main.c: In function 'iterative_deepening':
main.c:88:11: error: implicit declaration of function 'getAllMD'; did you mean 'getALLMD'? [-Wimplicit-function-declaration]
88 | in.md = getAllMD(in);
| ^~~~~~~~
| getALLMD
main.c:94:33: error: assignment to expression with array type
9... |
s509165719 | p02246 | C | #include <stdio.h>
#define SIZE 4
int board[SIZE][SIZE];
const int goal[SIZE][SIZE] = {{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,0}};
void read_board() {
for (int i = 0; i < SIZE; i++)
for (int j = 0; j < SIZE; j++)
scanf("%d", &board[i][j]);
}
void print() {
for (int i = 0; i < SIZE; i++) {
for ... | main.c: In function 'get_distance':
main.c:43:25: error: expected expression before '=' token
43 | if (board[i][j] !== goal[i][j]) ++sum;
| ^
|
s960690260 | p02246 | C | #include <stdio.h>
#include <stdlib.h>
#define tate 4
#define yoko 4
#define Total (tate*yoko)
int main( void )
{
int val[Total];
int i = 0;
int cnt, tmp = 0;
int finish = 0;
int num_0 = 0;
for(i=0; i<Total; i++)
{
scanf("%d",&val[i]);
if(val[i] == 0)
{
... | main.c: In function 'main':
main.c:29:19: error: expected ';' before 'tmp'
29 | val[num_0]
| ^
| ;
30 | tmp = 0;
| ~~~
|
s621763615 | p02246 | C | #include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int maxn = 4;
struct Puzzle
{
int f[maxn][maxn];
int spaceX;
int spaceY;
int dis;
};
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
bool is_valid(int x, int y){
return x >= 0 && x < maxn && y >= 0 ... | main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s853220779 | p02246 | C++ | #include<bits/stdc++.h>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
int dx[4]={0,-1,0,1};
int dy[4]={1,0,-1,0}; //注意这块有的数据可能因为走的方向不同而导致TLE
char dir[4]={'r','u','l','d'};
int MDT[N2][N2];
struct Puzzle{
int f[N2],space,MD;
};
Puzzle state;
int limit;
int path[LIMIT];
struct State{
... | a.cc: In function 'bool dfs(int, int)':
a.cc:71:36: error: a function-definition is not allowed here before '{' token
71 | string iterator_deeping(Puzzle in) {
| ^
a.cc:85:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
85 | int ... |
s381707435 | p02246 | C++ | from collections import deque
def move(P):
for i in range(4):
for j in range(4):
if P[i][j] == 0:
r,c = i,j
if not r == 0:
tmp = [i[:] for i in P]
tmp[r][c],tmp[r-1][c] = tmp[r-1][c],tmp[r][c]
yield tmp
if not r == 3:
tmp = [i[:] for i in P... | a.cc:1:1: error: 'from' does not name a type
1 | from collections import deque
| ^~~~
a.cc:26:1: error: 'd' does not name a type
26 | d = deque([(A,0)])
| ^
|
s401046202 | p02246 | C++ | from collections import deque
def move(P):
for i in range(4):
for j in range(4):
if P[i][j] == 0:
r,c = i,j
if not r == 0:
tmp = [i[:] for i in P]
tmp[r][c],tmp[r-1][c] = tmp[r-1][c],tmp[r][c]
yield tmp
if not r == 3:
tmp = [i[:] for i in P... | a.cc:1:1: error: 'from' does not name a type
1 | from collections import deque
| ^~~~
a.cc:26:1: error: 'd' does not name a type
26 | d = deque([(A,0)])
| ^
|
s735124144 | p02246 | C++ | from collections import deque
def move(P,p):
if p > 3:
tmp = P[:]
tmp[p],tmp[p-4] = tmp[p-4],tmp[p]
tmpp = p - 4
yield tmp,tmpp
if p < 12:
tmp = P[:]
tmp[p],tmp[p+4] = tmp[p+4],tmp[p]
tmpp = p + 4
yield tmp,tmpp
if p%4 > 0:
tmp = P[:]
... | a.cc:1:1: error: 'from' does not name a type
1 | from collections import deque
| ^~~~
a.cc:40:1: error: 'd' does not name a type
40 | d = deque([(A,0,A.index(0))])
| ^
|
s336111138 | p02246 | C++ | from collections import deque
import heapq
def move(P,p):
if p > 3:
tmp = P[:]
tmp[p],tmp[p-4] = tmp[p-4],tmp[p]
tmpp = p - 4
yield tmp,tmpp
if p < 12:
tmp = P[:]
tmp[p],tmp[p+4] = tmp[p+4],tmp[p]
tmpp = p + 4
yield tmp,tmpp
if p%4 > 0:
... | a.cc:1:1: error: 'from' does not name a type
1 | from collections import deque
| ^~~~
a.cc:41:1: error: 'h' does not name a type
41 | h = [(evaluate(A,B),A,0,A.index(0))]
| ^
|
s945210926 | p02246 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <concurrent_priority_queue.h>
#define RC2P(r,c) (((r)<<2)+(c)) //r*4+c
#define P2R(p) ((p)>>2) //p/4
#define P2C(p) ((p)&3) //p%4
#define HASHMAX 1000003
typedef unsigned long long int Pkey;
struct Pandt{
Pkey p;
int t;
Pandt(){ return; }
Pa... | a.cc:4:10: fatal error: concurrent_priority_queue.h: No such file or directory
4 | #include <concurrent_priority_queue.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s049691464 | p02246 | C++ | #include<iostream>
#include<queue>
#include<set>
#include<algorithm>
using namespace std;
struct Puzzle{
int a[4][4];
int calcDist(){
int u,v, sum=0;
for(int i=1;i<16;i++){
for(int j=0;j<16;j++){
if(i==a[j/4][j%4]){
... | In file included from /usr/include/c++/14/string:49,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/includ... |
s652708048 | p02246 | C++ | // ------ Includes ------ //
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <iostream>
using namespace std;
// ------ Directions ------ //
const int dx[4] = { 0, 1, 0, -1 };
const int dy[4] = { 1, 0, -1, 0 };
// ------ BFS ------ //
int BFS(vector<vector<int> > p)
... | a.cc: In function 'int BFS(std::vector<std::vector<int> >)':
a.cc:30:6: error: no match for 'operator[]' (operand types are 'std::map<std::vector<std::vector<char> >, int>' and 'std::vector<std::vector<int> >')
30 | D[p] = 1; que.push(make_pair(p, 1));
| ^
In file included from /usr/include/c++/14/map... |
s323731739 | p02246 | C++ | // ------ Includes ------ //
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <iostream>
using namespace std;
// ------ Directions ------ //
const int dx[4] = { 0, 1, 0, -1 };
const int dy[4] = { 1, 0, -1, 0 };
// ------ BFS ------ //
int BFS(vector<vector<char> > p)... | a.cc: In function 'int main()':
a.cc:91:54: error: no matching function for call to 'std::vector<std::vector<char> >::vector(int, std::vector<int>)'
91 | vector<vector<char> > board(4, vector<int>(4, -1)); int S;
| ^
In file included from /usr/include/c+... |
s638739948 | p02246 | C++ | // ------ Includes ------ //
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <iostream>
using namespace std;
// ------ Directions ------ //
const int dx[4] = { 0, 1, 0, -1 };
const int dy[4] = { 1, 0, -1, 0 };
// ------ BFS ------ //
int BFS(vector<vector<char> > p)... | a.cc: In function 'int main()':
a.cc:91:54: error: no matching function for call to 'std::vector<std::vector<char> >::vector(int, std::vector<int>)'
91 | vector<vector<char> > board(4, vector<int>(4, -1)); int S;
| ^
In file included from /usr/include/c+... |
s787229474 | p02246 | C++ | // ------ Includes ------ //
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <iostream>
using namespace std;
// ------ Directions ------ //
const int dx[4] = { 0, 1, 0, -1 };
const int dy[4] = { 1, 0, -1, 0 };
// ------ BFS ------ //
int BFS(vector<vector<char> > p)... | a.cc: In function 'int main()':
a.cc:97:20: error: 'A' was not declared in this scope
97 | cin >> A;
| ^
|
s173794526 | p02246 | C++ | /**
* @brief 15パズル問題を扱う
*
* @date 2016/02/29
*/
//****************************************
// 必要なヘッダファイルのインクルード
//****************************************
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <string>
//****************************************
// 型シノニム
//************... | a.cc: In function 'std::string idastar(puzzle&)':
a.cc:141:31: error: 'numeric_limits' is not a member of 'std'
141 | if (visit(_s, 0, std::numeric_limits<int>::min(), limit)) {
| ^~~~~~~~~~~~~~
a.cc:141:46: error: expected primary-expression before 'int'
141 | if... |
s173165532 | p02246 | C++ | /**
* @brief 15パズル問題をA*で解く
*
* @date 2016/02/29
*/
//****************************************
// 必要なヘッダファイルのインクルード
//****************************************
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <limits>
//****************************************
//... | a.cc:89:10: error: 'bool cmp::operator<(const state&, const state&)' must have exactly one argument
89 | bool operator < (const state& s, const state& t) { return s.p < t.p; }
| ^~~~~~~~
|
s401273232 | p02246 | C++ | /**
* @brief 15パズル問題をA*で解く
*
* @date 2016/02/29
*/
//****************************************
// 必要なヘッダファイルのインクルード
//****************************************
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <limits>
//****************************************
//... | a.cc: In function 'int astar(puzzle&)':
a.cc:164:43: error: 'close' was not declared in this scope; did you mean 'closed'?
164 | if ((v.gstar + v.hstar) < close[v].first) { // より低いコストで再訪問しているか調べる
| ^~~~~
| ... |
s707840955 | p02246 | C++ | #include<iostream>
#include<queue>
#include<cmath>
#include<functional>
#include<algorithm>
using namespace std;
struct Puzzle {
int x[4][4];
};
priority_queue<pair<int, Puzzle>, vector<pair<int, Puzzle>>, greater<pair<int, Puzzle>>>Q; Puzzle Z;
int manh(Puzzle y) {
int sum = 0; pair<int, int> p[16];
for (int i = 0;... | In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from... |
s969192455 | p02246 | C++ | #include<iostream>
#include<queue>
#include<cmath>
#include<functional>
#include<algorithm>
using namespace std;
struct Puzzle {
int x[4][4];
};
priority_queue<pair<int, Puzzle>, vector<pair<int, Puzzle>>, greater<pair<int, Puzzle>>>Q; Puzzle Z;
int manh(Puzzle y) {
int sum = 0; pair<int, int> p[16];
for (int i = 0;... | In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from... |
s016577660 | p02246 | C++ | #include<iostream>
#include<queue>
#include<cmath>
#include<functional>
#include<vector>
#include<algorithm>
using namespace std;
struct Puzzle {
int x[4][4];
};
priority_queue<pair<int, Puzzle>, vector<pair<int, Puzzle>>, greater<pair<int, Puzzle>>>Q; Puzzle Z;
int manh(Puzzle y) {
int sum = 0; pair<int, int> p[16];... | In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from... |
s316613429 | p02246 | C++ | #include<iostream>
#include<queue>
#include<cmath>
#include<functional>
#include<vector>
#include<algorithm>
using namespace std;
struct Puzzle {
int x[4][4];
};
priority_queue<pair<int, Puzzle>, vector<pair<int, Puzzle>>, greater<pair<int, Puzzle>>>Q; Puzzle Z;
int manh(Puzzle y) {
int sum = 0; pair<int, int> p[16];... | In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from... |
s526283905 | p02246 | C++ | #include <map>
#include <queue>
#include <iostream>
typedef unsigned long long ull;
using namespace std;
struct state { ull x; int zero, dist, remain; };
bool operator<(const state& s1, const state& s2) { return s1.dist + s1.remain > s2.dist + s2.remain; }
int a, dist[16][16], goals[16]; ull s, goal = 11477974090308165... | a.cc: In function 'int solve()':
a.cc:29:31: error: 'class std::priority_queue<state>' has no member named 'front'
29 | state a = que.front(); que.pop();
| ^~~~~
|
s429284700 | p02246 | C++ | #include <map>
#include <queue>
#include <iostream>
#pragma warning(disable : 4996)
typedef unsigned long long ull;
using namespace std;
struct state { ull x; int zero, pre, dist, remain; };
bool operator<(const state& s1, const state& s2) { return s1.dist + s1.remain > s2.dist + s2.remain; }
int a, dist[16][16], goals... | a.cc: In function 'int main()':
a.cc:64:9: error: '_sleep' was not declared in this scope
64 | _sleep(2000);
| ^~~~~~
|
s809992487 | p02246 | C++ | #include <bits/stdc++.h>
typedef unsigned long long ull;
using namespace std;
struct state { ull x; int zero, pre, dist, remain; };
bool operator<(const state& s1, const state& s2) { return s1.dist + s1.remain > s2.dist + s2.remain; }
int a, cz, dist[16][16]; ull s, goal = 1147797409030816545;
int goals[] = { 1, 2, 3, ... | a.cc:66:5: error: redefinition of 'int solve()'
66 | int solve() {
| ^~~~~
a.cc:35:5: note: 'int solve()' previously defined here
35 | int solve() {
| ^~~~~
|
s191724452 | p02246 | C++ | #define FOR(i,n) for(int i=0; i<n; ++i)
#define GET(type,name) type name; std::cin >> name;
//include STL libs
#include <iostream>
#include <vector>
#include <utility>
#include <utility>
#include <algorithm>
#include <queue>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
typedef std::vecto... | a.cc:18:32: error: conflicting declaration 'typedef long long unsigned int ulong'
18 | typedef unsigned long long ulong;
| ^~~~~
In file included from /usr/include/stdlib.h:514,
from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ex... |
s587121193 | p02246 | C++ | #define FOR(i,n) for(int i=0; i<n; ++i)
#define GET(type,name) type name; std::cin >> name;
//include STL libs
#include <iostream>
#include <vector>
#include <utility>
#include <utility>
#include <algorithm>
#include <queue>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
typedef std::vecto... | a.cc:18:32: error: conflicting declaration 'typedef long long unsigned int ulong'
18 | typedef unsigned long long ulong;
| ^~~~~
In file included from /usr/include/stdlib.h:514,
from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ex... |
s398501488 | p02246 | C++ | #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cc... | a.cc: In function 'int main()':
a.cc:100:53: error: expected '}' at end of input
100 | int x = s.pnt.first + dx[i];
| ^
a.cc:98:27: note: to match this '{'
98 | REP(i, 4) {
| ^
a.cc:100... |
s888944573 | p02246 | C++ | #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cc... | a.cc: In function 'int main()':
a.cc:100:53: error: expected '}' at end of input
100 | int x = s.pnt.first + dx[i];
| ^
a.cc:98:27: note: to match this '{'
98 | REP(i, 4) {
| ^
a.cc:100... |
s468802468 | p02246 | C++ | #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <queue>
#include <cmath>
#include <vector>
using namespace std;
const int num = 16, ud[] = { -1, 0, 1, 0 }, lr[] = { 0, -1, 0, 1 }, nd = 4;
const char wa[] = { 'u', 'l', 'd', 'r' ... | a.cc: In function 'bool dfs(int, int)':
a.cc:63:16: error: redeclaration of 'puzzle tmp'
63 | puzzle tmp;
| ^~~
a.cc:62:16: note: 'puzzle tmp' previously declared here
62 | puzzle tmp;
| ^~~
|
s604193349 | p02246 | C++ | #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <queue>
#include <cmath>
#include <vector>
using namespace std;
const int num = 16, ud[] = { -1, 0, 1, 0 }, lr[] = { 0, -1, 0, 1 }, nd = 4;
const char wa[] = { 'u', 'l', 'd', 'r' ... | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s469344402 | p02246 | C++ | define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <queue>
#include <cmath>
#include <vector>
using namespace std;
const int num = 16, ud[] = { -1, 0, 1, 0 }, lr[] = { 0, -1, 0, 1 }, nd = 4;
int md[num][num];
int lm;
struct puzzle ... | a.cc:1:1: error: 'define' does not name a type
1 | define _CRT_SECURE_NO_WARNINGS
| ^~~~~~
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,
... |
s721825596 | p02246 | C++ | #include <iostream>
#include <assert.h>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <climits>
#define N 4
#define N2 16
using namespace std;
// const int N = 4;
// const int N2 = 16;
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char... | a.cc:35:9: error: 'vector' does not name a type
35 | vector<int> path;
| ^~~~~~
a.cc: In member function 'bool Npuzzle::dfs(Node, int, int)':
a.cc:98:33: error: 'path' was not declared in this scope
98 | path[depth] = i;
| ... |
s496152252 | p02246 | C++ | #include<stdio.h>
#include<iostream>
#include<cmath>
#include<string>
#include<cassert>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
struct Puzzle{
int f[N2], space, MD;
};
static const int dx[4] = {0,-1,0,1};
static const int dy[4] = {1,0,-1,0};
static const char dir[4] = {'r','u','l','d'};
int... | a.cc:62:17: error: 'Pazzle' was not declared in this scope; did you mean 'Puzzle'?
62 | string iterdeep(Pazzle in){
| ^~~~~~
| Puzzle
a.cc:62:27: error: expected ',' or ';' before '{' token
62 | string iterdeep(Pazzle in){
| ^
a.cc: In fu... |
s192425569 | p02246 | C++ | #include<stdio.h>
#include<iostream>
#include<cmath>
#include<string>
#include<cassert>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
struct Puzzle{
int f[N2], space, MD;
};
static const int dx[4] = {0,-1,0,1};
static const int dy[4] = {1,0,-1,0};
static const char dir[4] = {'r','u','l','d'};
int... | a.cc:95:5: error: redefinition of 'int main()'
95 | int main(){
| ^~~~
a.cc:76:5: note: 'int main()' previously defined here
76 | int main(){
| ^~~~
|
s860070790 | p02246 | C++ | include<stdio.h>
#include<iostream>
#include<cmath>
#include<string>
#include<cassert>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = { 'r', 'u', 'l', 'd'};
int MDT[N2][N2];
struct Puzzle{int... | a.cc:1:1: error: 'include' does not name a type
1 | include<stdio.h>
| ^~~~~~~
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,
fr... |
s023067507 | p02246 | C++ | include<stdio.h>
#include<iostream>
#include<cmath>
#include<string>
#include<cassert>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = { 'r', 'u', 'l', 'd'};
int MDT[N2][N2];
struct Puzzle{int... | a.cc:1:1: error: 'include' does not name a type
1 | include<stdio.h>
| ^~~~~~~
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,
fr... |
s625338987 | p02246 | C++ | #include <iostream>
#include <assert.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <climits>
#include <stack>
#define N 4
#define N2 16
using namespace std;
// const int N = 4;
// const int N2 = 16;
static const int dx[4] = {0, -1, 0, 1};
static const int... | a.cc: In member function 'bool Npuzzle::dfs(int)':
a.cc:139:23: error: 'depth' was not declared in this scope
139 | ans = depth;
| ^~~~~
a.cc:151:24: error: 'pre' was not declared in this scope
151 | if(max(pre, i) - min(pre, i) == 2) continue;
| ... |
s469623902 | p02246 | C++ | #include <iostream>
#include <assert.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <climits>
#include <stack>
#define N 4
#define N2 16
using namespace std;
// const int N = 4;
// const int N2 = 16;
static const int dx[4] = {0, -1, 0, 1};
static const int... | a.cc: In member function 'bool Npuzzle::dfs(int)':
a.cc:139:23: error: 'depth' was not declared in this scope
139 | ans = depth;
| ^~~~~
a.cc:151:24: error: 'pre' was not declared in this scope
151 | if(max(pre, i) - min(pre, i) == 2) continue;
| ... |
s436681076 | p02246 | C++ | #include <iostream>
#include <assert.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <climits>
#include <stack>
#define N 4
#define N2 16
using namespace std;
// const int N = 4;
// const int N2 = 16;
static const int dx[4] = {0, -1, 0, 1};
static const int... | a.cc:31:9: error: expected ';' at end of member declaration
31 | int pre
| ^~~
| ;
a.cc: In member function 'bool Npuzzle::dfs(int)':
a.cc:89:23: error: 'depth' was not declared in this scope
89 | ans = depth;
| ^~~~~
|
s395957424 | p02246 | C++ | #include <iostream>
#include <assert.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <climits>
#include <stack>
#define N 4
#define N2 16
using namespace std;
// const int N = 4;
// const int N2 = 16;
static const int dx[4] = {0, -1, 0, 1};
static const int... | a.cc: In function 'void input_table()':
a.cc:46:25: error: expected ';' before 'cin'
46 | scanf("%d", tmp)
| ^
| ;
47 | cin >> tmp;
| ~~~
a.cc:54:5: error: 'set_md' was not declared in this scope
54 | se... |
s795082308 | p02246 | C++ | #include <iostream>
#include <stdio.h>
#include <assert.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <climits>
#include <stack>
#define N 4
#define N2 16
using namespace std;
// const int N = 4;
// const int N2 = 16;
static const int dx[4] = {0, -1, 0, 1... | a.cc: In function 'void input_table()':
a.cc:47:25: error: expected ';' before 'cin'
47 | scanf("%d", tmp)
| ^
| ;
48 | cin >> tmp;
| ~~~
a.cc:55:5: error: 'set_md' was not declared in this scope
55 | se... |
s708861299 | p02246 | C++ | #include <iostream>
#include <stdio.h>
#include <assert.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <climits>
#include <stack>
#define N 4
#define N2 16
using namespace std;
// const int N = 4;
// const int N2 = 16;
static const int dx[4] = {0, -1, 0, 1... | a.cc: In function 'int main()':
a.cc:137:18: error: expected ';' before 'ida_star'
137 | input_table()
| ^
| ;
138 | ida_star();
| ~~~~~~~~
|
s321895770 | p02246 | C++ | #include<iostream>
#include<map>
#include<string>
#include<vector>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
using namespace std;
int inf = 1000000000;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
vector<int> trans(vector< vector<int> > a){
vector<int> t(16);
for(int i=0; i<4; i++) ... | a.cc: In function 'void bfs(std::vector<int>)':
a.cc:36:8: error: no match for 'operator[]' (operand types are 'std::map<bool, int>' and 'std::vector<int>')
36 | mpb[s] = true;
| ^
In file included from /usr/include/c++/14/map:63,
from a.cc:2:
/usr/include/c++/14/bits/stl_map.h:504:... |
s120587532 | p02246 | C++ | #include<iostream>
#include<map>
#include<string>
#include<vector>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
using namespace std;
int inf = 1000000000;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
bool check(vector<int> a){
for(int i=0; i<16; i++) if( a[i] != (i+1)%16 ) return false;
... | a.cc: In function 'void bfs(std::vector<int>)':
a.cc:61:45: error: expected ';' before ':' token
61 | if( p.second.first > 46 ) continue:
| ^
| ;
a.cc:61:45: error: expected primary-expression before ':' tok... |
s279740945 | p02246 | C++ | // ALDS1_13_C.cpp
// Heuristic Search - 15 Puzzle
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
const int N = 4;
const int N2 = 16;
const int INF = 50;
struct Puzzle {
int f[N2];
//int space;
string path;
bool operator < (const Puzzle &p) const {
... | a.cc: In function 'bool bfs(int)':
a.cc:75:19: error: 'limit' was not declared in this scope
75 | if (ms[in] || limit < i + getAllMD(in)) {
| ^~~~~
a.cc: In function 'void iterative_deepening()':
a.cc:107:14: error: 'limit' was not declared in this scope
107 | for (limit = getAl... |
s009902541 | p02246 | C++ | #include <vector>
#include <queue>
#include <unordered_map>
#include <cstdio>
#include <cstdlib>
using namespace std;
#define X 4
#define Y 4
#define THRESHOLD 2
namespace std{
template<typename T>
inline void hash_combine(size_t& seed, T const& v){
seed ^= hash<T>()(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
}
... | a.cc: In function 'int main()':
a.cc:83:41: error: conversion from 'vector<char>' to non-scalar type 'vector<int>' requested
83 | vector<int> v=q.front().first;
| ~~~~~~~~~~^~~~~
a.cc:89:27: error: no match for 'operator[]' (operand types are 'std::unordered_map<st... |
s233245708 | p02246 | C++ | #include <vector>
#include <queue>
#include <unordered_map>
#include <cstdio>
#include <cstdlib>
using namespace std;
#define X 4
#define Y 4
#define THRESHOLD 2
namespace std{
template<typename T>
inline void hash_combine(size_t& seed, T const& v){
seed ^= hash<T>()(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
}
... | a.cc: In function 'int main()':
a.cc:86:30: error: invalid initialization of reference of type 'std::vector<int>&' from expression of type 'std::vector<char>'
86 | int val=calc(v);
| ^
a.cc:55:22: note: in passing argument 1 of 'int calc(std::vector<int>&)'
55 | ... |
s272473867 | p02246 | C++ | #include <cstdio>
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define N 4
#define NN 16
static const int dx[4] = {0,-1,0,1};
static const int dy[4] = {1,0,-1,0};
int H[NN][NN];
struct Puzzle
{
int f[NN],space,MD;
int cost;
bool operator < (const Puzzle& p) const... | a.cc: In member function 'bool Puzzle::operator<(const Puzzle&) const':
a.cc:21:20: error: 'N2' was not declared in this scope; did you mean 'NN'?
21 | for(int i=0; i<N2; i++) {
| ^~
| NN
a.cc: In function 'int getAllMD(Puzzle)':
a.cc:40:20: error: 'N2' was not d... |
s648710669 | p02246 | C++ | #include <cstdio>
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define N 4
#define NN 16
static const int dx[4] = {0,-1,0,1};
static const int dy[4] = {1,0,-1,0};
int H[NN][NN];
struct Puzzle
{
int f[NN],space,MD;
int cost;
bool operator < (const Puzzle& p) const... | a.cc: In member function 'bool Puzzle::operator<(const Puzzle&) const':
a.cc:21:20: error: 'N2' was not declared in this scope; did you mean 'NN'?
21 | for(int i=0; i<N2; i++) {
| ^~
| NN
a.cc: In function 'int getAllMD(Puzzle)':
a.cc:40:20: error: 'N2' was not d... |
s656938883 | p02246 | C++ | #include <stdio.h>
#include <stdlib.h>
#define N 4
#define NN N*N
#define LIMIT 100
int H[NN][NN];//マンハッタン距離の組み合わせの集合
int dx[4] = {0,-1,0,1};
int dy[4] = {1,0,-1,0}; //方向
int states_count = 0;
void swap(int *x,int *y){
int tmp;
tmp = *x;
*x = *y;
*y = tmp;
}
typedef struct puzzle
{
int field[NN];//どの場所になん... | a.cc: In function 'int isSolved()':
a.cc:43:23: error: 'N2' was not declared in this scope; did you mean 'NN'?
43 | for (int i = 0; i < N2; ++i)if(state.field[i] != i+1)return 0;
| ^~
| NN
a.cc: In function 'int iterative_deepening(Puzzle)':
a.cc:74:6: error:... |
s782571976 | p02246 | C++ | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
| |
s113826950 | p02246 | C++ | // Iterative Deepening
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<string>
#include<cassert>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const int char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2... | a.cc:14:8: error: two or more data types in declaration of 'dir'
14 | static const int char dir[4] = {'r', 'u', 'l', 'd'};
| ^~~~~
a.cc: In function 'std::string iterative_deepening(Puzzle)':
a.cc:73:48: error: 'dir' was not declared in this scope; did you mean 'div'?
73 | for ( int i = 0; i < ... |
s745794113 | p02246 | C++ | #include<cstdio>
#include<iostream>
#include<cmath>
#include<map>
#include<queue>
using namespace std;
#define N 4
#define N2 16
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];
struct Puzzle {
int f[N2], space, MD;
... | a.cc: In function 'int main()':
a.cc:104:11: error: 'aster' was not declared in this scope; did you mean 'astar'?
104 | cout << aster(in) << endl;
| ^~~~~
| astar
|
s976727867 | p02246 | C++ | #include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
#define size 4
int move[4][2]={{-1,0},{0,-1},{0,1},{1,0}};//上 左 右 下 置换顺序
char op[4]={'U','L','R','D'};
int map[size][size],map2[size*size],limit,path[100];
int flag,length;
int goal[16][2]= {{3,3},{0,0},{0,1}, {0,2},{0,3}, ... | a.cc: In function 'void dfs(int, int, int, int)':
a.cc:88:15: error: reference to 'move' is ambiguous
88 | nx=sx+move[i][0]; //移动的四步 上左右下
| ^~~~
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:4:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:353:1: not... |
s403155744 | p02246 | C++ | #include<iostream>
#include<cmath>
using namespace std;
const int N = 4;
const int N2 = 16;
const int LIMIT = 45;
const int mx[4] = {0,-1,0,1};
const int my[4] = {-1,0,1,0};
struct Puzzle {
int p[N2], h, d;
};
Puzzle ans;
int limit, md[N2][N2];
bool visit(Puzzle a,int prev) {
if(a.h==0) {
ans = a;
... | a.cc: In function 'bool visit(Puzzle, int)':
a.cc:35:62: error: expected ']' before ';' token
35 | b.h += md[blank][b.p[blank] - md[y*N+x][b.p[y*N+x]-1];
| ^
| ]
|
s530348323 | p02246 | C++ | goal = ((1, 2, 3, 4), (5, 6, 7, 8), (9, 10, 11, 12), (13, 14, 15, 0))
goal_position = [
[3, 3],
[0, 0],
[0, 1],
[0, 2],
[0, 3],
[1, 0],
[1, 1],
[1, 2],
[1, 3],
[2, 0],
[2, 1],
[2, 2],
[2, 3],
[3, 0],
[3, 1],
[3, 2]
]
N = 4
stack = []
steps = []
positions = []
hash_stack = []
initial = []
position = []
hash_table = s... | a.cc:1:1: error: 'goal' does not name a type
1 | goal = ((1, 2, 3, 4), (5, 6, 7, 8), (9, 10, 11, 12), (13, 14, 15, 0))
| ^~~~
|
s115526089 | p02246 | C++ | #include<stdio.h>
#include<map>
#include<iostream>
#include<stdlib.h>
#include<queue>
#include<algorithm>
#include<set>
std::map<unsigned __int64,int> memo2;
const int LIMIT=19;
int xs[16]={3, 0,1,2,3, 0,1,2,3, 0,1,2,3, 0,1,2};
int ys[16]={3, 0,0,0,0, 1,1,1,1, 2,2,2,2, 3,3,3};
int m(unsigned __int64 e1){
uns... | a.cc:8:30: error: wrong number of template arguments (1, should be at least 2)
8 | std::map<unsigned __int64,int> memo2;
| ^
In file included from /usr/include/c++/14/map:63,
from a.cc:2:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<clas... |
s350945592 | p02246 | C++ | #include<stdio.h>
#include<string>
#include<iostream>
#include<cmath>
#include<cassert>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = { 'r', 'u', 'l', 'd'};
int MDT[N2][N2];
struct P{int f[... | a.cc: In function 'std::string ku(P)':
a.cc:37:8: error: 'dfs' was not declared in this scope
37 | if(dfs(0, -100)){
| ^~~
|
s694074873 | p02246 | C++ | #include <iostream>
#include <unorderd_set>
#include <string>
#include <vector>
using namespace std;
#define N 4
string goal("bcdefghijklmnopa");
int calc_heuristic(string state){
int count = 0;
for(int i=0 ; i < 15 ; i++ ) if(state[i] != goal[i]) count++;
return count;
}
int main(void){
vector<string> st_stk;... | a.cc:2:10: fatal error: unorderd_set: No such file or directory
2 | #include <unorderd_set>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s068478544 | p02246 | C++ |
from heapq import heappop, heappush
from functools import lru_cache
@lru_cache(maxsize=None)
def manhattan(size, i, n):
if n == 0:
return 0
else:
dn, mn = divmod(n-1, size)
di, mi = divmod(i, size)
return abs(dn-di) + abs(mn-mi)
class Board:
__slots__ = ('size', 'nums'... | a.cc:6:1: error: stray '@' in program
6 | @lru_cache(maxsize=None)
| ^
a.cc:17:18: warning: multi-character character constant [-Wmultichar]
17 | __slots__ = ('size', 'nums', 'code', '_hash')
| ^~~~~~
a.cc:17:26: warning: multi-character character constant [-Wmultichar]
17 | ... |
s274617290 | p02246 | C++ |
#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];
struct Puzzle {
int ... | a.cc: In function 'bool isSolved()':
a.cc:42:23: error: 'n' was not declared in this scope
42 | if (state.f[i] != n + 1) {
| ^
a.cc: In function 'bool dfs(int, int)':
a.cc:74:5: error: 'sate' was not declared in this scope; did you mean 'state'?
74 | sate.space = tx * N + ty;
... |
s771935100 | p02246 | C++ |
#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];
struct Puzzle {
int ... | a.cc: In function 'bool isSolved()':
a.cc:42:23: error: 'n' was not declared in this scope
42 | if (state.f[i] != n + 1) {
| ^
a.cc: In function 'bool dfs(int, int)':
a.cc:74:5: error: 'sate' was not declared in this scope; did you mean 'state'?
74 | sate.space = tx * N + ty;
... |
s605240112 | p02246 | C++ |
#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];
struct Puzzle {
int ... | a.cc: In function 'bool dfs(int, int)':
a.cc:74:5: error: 'sate' was not declared in this scope; did you mean 'state'?
74 | sate.space = tx * N + ty;
| ^~~~
| state
a.cc: In function 'std::string iterative_deepening(Puzzle)':
a.cc:88:5: error: 'sate' was not declared in this scope; did you me... |
s211924788 | p02246 | C++ |
#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];
struct Puzzle {
int ... | a.cc: In function 'std::string iterative_deepening(Puzzle)':
a.cc:88:5: error: 'sate' was not declared in this scope; did you mean 'state'?
88 | sate = in;
| ^~~~
| state
a.cc: In function 'int main()':
a.cc:103:58: error: expected ';' before '}' token
103 | MDT[i][j] = abs(i / N - j ... |
s668142023 | p02246 | C++ | #include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];
struct Puzzle {
int f... | a.cc: In function 'int main()':
a.cc:102:58: error: expected ';' before '}' token
102 | MDT[i][j] = abs(i / N - j / N) + abs(i % N - j % N)
| ^
| ;
103 | }
| ~ ... |
s863903113 | p02246 | C++ |
#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];
struct Puzzle {
int ... | a.cc: In function 'int main()':
a.cc:117:14: error: expected identifier before '.' token
117 | cout << and.size() << endl;
| ^
|
s486541545 | p02246 | C++ | #include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];
struct Puzzle {
int f... | a.cc:38:8: error: expected ';' at end of member declaration
38 | bool operato < (const State& s) const {
| ^~~~~~~
| ;
a.cc:38:16: error: expected unqualified-id before '<' token
38 | bool operato < (const State& s) const {
| ^
a.cc: In function 'bool isSo... |
s828771574 | p02246 | C++ |
#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];
struct Puzzle {
int ... | a.cc: In function 'bool isSolved()':
a.cc:57:9: error: 'state' was not declared in this scope; did you mean 'State'?
57 | if (state.f[i] != i + 1) {
| ^~~~~
| State
a.cc: In function 'int astat(Puzzle)':
a.cc:66:3: error: 's' was not declared in this scope
66 | s.MD = getAllMD(s)... |
s096293123 | p02246 | C++ |
#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];
struct Puzzle {
int ... | a.cc: In function 'int astar(Puzzle)':
a.cc:57:3: error: 's' was not declared in this scope
57 | s.MD = getAllMD(s);
| ^
|
s935932356 | p02246 | C++ | package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
const (
N = 4
BASE = 10007
MOD = 1000000007
)
// Go cannot create const array?
var solvedBoard [N * N]int = [N * N]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0}
type Puzzle struct {
board [N * N]int // (x, y). (0, 0) = 0, (1, 0) = 1, (0, ... | a.cc:1:1: error: 'package' does not name a type
1 | package main
| ^~~~~~~
a.cc:19:1: error: 'type' does not name a type; did you mean 'typeof'?
19 | type Puzzle struct {
| ^~~~
| typeof
a.cc:23:1: error: 'type' does not name a type; did you mean 'typeof'?
23 | type SolveContext struct {
... |
s028576095 | p02246 | C++ | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <lim... | a.cc:29:16: error: 'Puzzle' was not declared in this scope
29 | priority_queue<Puzzle> que;
| ^~~~~~
a.cc:29:22: error: template argument 1 is invalid
29 | priority_queue<Puzzle> que;
| ^
a.cc:29:22: error: template argument 2 is invalid
a.cc:29:22: error: template ... |
s391733495 | p02247 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
public static void main(String[] args)throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str1 = br.readLine();
String str2 = br.readLine();
... | Main.java:6: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args)throws IOException{
^
(use --enable-preview to enable unnamed classes)
Main.java:30: error: class, interface, enum, or record expected
}
^
2 errors
|
s222118878 | p02247 | Java | //API???????????????
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
class Main {
public static void main(String[] args)throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str1 = br.readLine... | Main.java:5: error: LinkedList is already defined in this compilation unit
import java.util.LinkedList;
^
Main.java:24: error: cannot find symbol
list.insert(str1.indexOf(str2));
^
symbol: method insert(int)
location: variable list of type LinkedList
Main.java:25: error: cannot find symbol
while(str1.in... |
s963011765 | p02247 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
String t = scan.next();
String p = scan.next();
nFind(t, p);
scan.colse();
System.exit(0);
}
private static void nFind(String t, String p){
for(int st = 0; st < t.length() - p.leng... | Main.java:12: error: cannot find symbol
scan.colse();
^
symbol: method colse()
location: variable scan of type Scanner
Main.java:18: error: cannot find symbol
if(isEqual(t, p, st))
^
symbol: method isEqual(String,String,int)
location: class Main
2 errors
|
s408385364 | p02247 | C | #include <stdio.h>
#include <string.h>
int find(char *a, char *b, int i, int al){
int j;
for(j = 0; j < al; j++){
if(a[i+j] != b[j]){
return 0;
}
}
return -1;
}
int main(){
char a[1000], b[1000];
int i, , plength;
scanf("%s", a);
scanf("%s", b);
al = strlen(a);
bl = strlen(b);
... | main.c: In function 'main':
main.c:17:10: error: expected identifier or '(' before ',' token
17 | int i, , plength;
| ^
main.c:22:3: error: 'al' undeclared (first use in this function); did you mean 'a'?
22 | al = strlen(a);
| ^~
| a
main.c:22:3: note: each undeclared identifier... |
s700218713 | p02247 | C | #include<stdio.h>
#include<string.h>
#define MAX 1000
int main(){
int i,j;
int n;
int k = 0;
int total = 0;
int t, p;
int v[MAX];
char T[MAX],P[MAX];
scanf("%s%s",T,P);
t=strlen(T);
p=strlen(P);
for(i = 0;i < t;i++){
if(T[i] == P[0]){
j = i+1;
n = 1;
wh... | main.c: In function 'main':
main.c:35:7: error: expected '}' before 'else'
35 | else if(n == p){
| ^~~~
main.c: At top level:
main.c:42:3: error: expected identifier or '(' before 'for'
42 | for(k = 0;k < total;k++){
| ^~~
main.c:42:15: error: expected '=', ',', ';', 'asm' or '__attrib... |
s351405128 | p02247 | C | #include <stdio.h>
#include <string.h>
#define N 1001
int main(){
char T[N],P[N];
int i,j,l1,l2,flag;
scanf("%s",T);
scanf("%s",P);
l1=strlen(T);
l2=strlen(P);
for(i=0;i<l1;i++){
flag=0;
for(j=0;j<l2;j++){
if(T[i+j]==P[j]) flag++;
}
if(flag==l2) printf("%d\n",i);
}
... | main.c: In function 'main':
main.c:21:3: error: expected declaration or statement at end of input
21 | }
| ^
|
s003266858 | p02247 | C | char T[N],P[N]; | main.c:1:10: error: 'N' undeclared here (not in a function)
1 | char T[N],P[N];
| ^
|
s769536739 | p02247 | C | #include<stdio.h>
int check(int, int, int, int )
int main(){
int i, t[1000], p[1000], l=0, q=0;
while((t[l++]=getchar())!='\n'){}
while((p[q++]=getchar())!='\n'){}
for(i=0; i<l-q+1; i++)if(check(t, p, i, q-1))printf("%d\n", i);
return 0;
}
int check(int a[], int b[], int i, int q){
int j;
fo... | main.c: In function 'check':
main.c:3:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
3 | int main(){
| ^
main.c:10:42: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
10 | int check(int a[], int b[], int i, int q){
| ... |
s863996397 | p02247 | C | #include<stdio.h>
#include<string.h>
#define N 1000
int main() {
int i, j, len, flag;
char A[N], B[N];
scanf("%s", A);
scanf("%s", B);
for (i = 0; i < strlen(T); i++) {
flag = 0;
if (A[i] == B[0]) {
flag = 1;
for (j = 0; j < strlen(B); j++) {
... | main.c: In function 'main':
main.c:12:28: error: 'T' undeclared (first use in this function)
12 | for (i = 0; i < strlen(T); i++) {
| ^
main.c:12:28: note: each undeclared identifier is reported only once for each function it appears in
|
s893551961 | p02247 | C++ | #include <iostream>
#include <string>
using namespace std;
void solve(string T,string P){
int size = T.size() - P.size() +1;
for (int i = 0; i < size ; ++i) {
if(T[i] == P[0])
{
bool isSame = true;
for (int j = 0; j < P.size ; ++j) {
if( T[i+j] != P[j]) {... | a.cc: In function 'void solve(std::string, std::string)':
a.cc:11:35: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<cha... |
s273197644 | p02247 | C++ | # define _CRT_SECURE_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
#... | a.cc: In function 'int main()':
a.cc:120:21: error: 'class std::unordered_multimap<long long int, std::pair<int, int> >' has no member named 'lower_bound'
120 | auto i = ms.lower_bound(h), j = ms.upper_bound(h);
| ^~~~~~~~~~~
a.cc:121:22: error: 'j' was not declared in this scope
1... |
s776595939 | p02247 | C++ | import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
char[] s = scan.next().toCharArray();
char[] a = scan.next().toCharArray();
for(int i = 0; i < s.length - a.length + 1; i++){
for(int j = 0; j < a.length; j++){
if(a[j] == s[i + j])... | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:15: error: expected ':' before 'static'
4 | public static void main(String[] args) {
| ^~~~~~~
| :
... |
s891043437 | p02247 | C++ | include <string>
using namespace std;
int main() {
string s, t;
cin >> s >> t;
for ( int i = 0; i < s.size(); i++ ) {
for ( int j = 0, k = i; j < t.size(); k++) {
if ( s[k] != t[j++] ) break;
if ( t[j] == '\0' ) {
cout << i << endl;
}
}
}
return 0;
} | a.cc:1:1: error: 'include' does not name a type
1 | include <string>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:3: error: 'string' was not declared in this scope
5 | string s, t;
| ^~~~~~
a.cc:7:3: error: 'cin' was not declared in this scope
7 | cin >> s >> t;
| ^~~
a.cc:7:10... |
s662644959 | p02247 | C++ | #include <string>
using namespace std;
int main() {
string s, t;
cin >> s >> t;
for ( int i = 0; i < s.size(); i++ ) {
for ( int j = 0, k = i; j < t.size(); k++) {
if ( s[k] != t[j++] ) break;
if ( t[j] == '\0' ) {
cout << i << endl;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
7 | cin >> s >> t;
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <string>
+++ |+#include <iostream>
2 | using namespac... |
s860059536 | p02247 | C++ | #include <bits/stdc++.h>
??
using namespace std;
??
int main(){
????????int N,M;
????????string S,T;
????????cin >> S >> T;
????????N = S.size(); M = T.size();
????????for(int i = 0 ; i <= N-M ; i++){
????????????????bool ok = 1;
????????????????for(int j = 0 ; j < M ; j++){
????????????????????????if(T[j] != S[i+j]){
... | a.cc:2:1: error: expected unqualified-id before '?' token
2 | ??
| ^
a.cc:4:1: error: expected unqualified-id before '?' token
4 | ??
| ^
|
s855938977 | p02247 | C++ | #include<stdio.h>
#include<string.h>
#define N 1000
int main() {
int i, j, len, flag;
char A[N], B[N];
scanf("%s", A);
scanf("%s", B);
for (i = 0; i < strlen(T); i++) {
flag = 0;
if (A[i] == B[0]) {
flag = 1;
for (j = 0; j < strlen(B); j++) {
... | a.cc: In function 'int main()':
a.cc:12:28: error: 'T' was not declared in this scope
12 | for (i = 0; i < strlen(T); i++) {
| ^
|
s554786031 | p02247 | C++ | #include <iostream>
#include <string>
using namespace std;
int main() {
string s1, s2;
cin >> s1 >> s2;
for (int i = 0; i < s1.size(); ++i) {
int j = 0;
int k = i;
while (j < s2.size() && k < s1.size()) {
if (s1[koch_curve] != s2[j])
break;
... | a.cc: In function 'int main()':
a.cc:14:20: error: 'koch_curve' was not declared in this scope
14 | if (s1[koch_curve] != s2[j])
| ^~~~~~~~~~
|
s034190120 | p02248 | Java |
import java.io.IOException;
import java.util.Scanner;
public class Main_Kmp {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
String ori = in.nextLine();
String pattern = in.nextLine();
int next[] = new int[pattern.length() + 1];
... | Main.java:5: error: class Main_Kmp is public, should be declared in a file named Main_Kmp.java
public class Main_Kmp {
^
1 error
|
s367698692 | p02248 | Java | #include <iostream>
#include <cstring>
using namespace std;
typedef unsigned long long ull;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
char t[1000001], p[10001];
cin>>t>>p;
int tl=strlen(t);
int pl=strlen(p);
if(pl>tl) return 0;
const ull base = 1000000007ULL;
ull bt = 1;... | Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:2: error: illegal character: '#'
#include <cstring>
^
Main.java:4: error: class, interface, enum, or record expected
typedef unsigned long long ull;
^
Main.java:8: error: not a statement
ios::sync_with_stdio(false);
^
Main.java:10: error... |
s159030235 | p02248 | Java | import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main{
public static void main(String []args)???throws IOException {
BufferedReader br = new BufferedReamder(new InputStreamReader(System.in));
String text = br.readLine();
String pa... | Main.java:6: error: ';' expected
public static void main(String []args)???throws IOException {
^
1 error
|
s921200403 | p02248 | Java | import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main{
public static void main(String []args){
BufferedReader br = new BufferedReamder(new InputStreamReader(System.in));
String text = br.readLine();
String pattern = br.readLine();... | Main.java:7: error: cannot find symbol
BufferedReader br = new BufferedReamder(new InputStreamReader(System.in));
^
symbol: class BufferedReamder
location: class Main
1 error
|
s277293803 | p02248 | Java | import java.io.IOException;
import java.util.Scanner;
class Main{
public static void main(String[] args)throws IOException{
Scanner scan = new Scanner(System.in);
String str1 = scan.nextLine();
String str2 = scan.nextLine();
int[] x = new int[4];
LinkedList list = new LinkedList();
if(str1.length() < str... | Main.java:77: error: class, interface, enum, or record expected
}
^
1 error
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.