Search is not available for this dataset
name
stringlengths
2
88
description
stringlengths
31
8.62k
public_tests
dict
private_tests
dict
solution_type
stringclasses
2 values
programming_language
stringclasses
5 values
solution
stringlengths
1
983k
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int tx[] = {0, 1, 0, -1}; int ty[] = {-1, 0, 1, 0}; static const double EPS = 1e-8; const static char dir[4] = {'U', 'R', 'D', 'L'}; const static string dir_str[4] = {"U", "R", "D", "L"}; namespace AhoCorasick { class Node; class SearchMachine; struct MatchingResult { map...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int tx[] = {0, 1, 0, -1}; int ty[] = {-1, 0, 1, 0}; static const double EPS = 1e-8; const static char dir[4] = {'U', 'R', 'D', 'L'}; const static string dir_str[4] = {"U", "R", "D", "L"}; class Nodes { public: class Nodes* children[256]; bool has_word; Nodes() : has_...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int m, n, nr, ns; string mat[530]; string rule[130]; int d[53][53][500]; int t[500][4]; string suf[113]; int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, 1, 0, -1}; char dc[4] = {'U', 'R', 'D', 'L'}; struct Status { int x, y, s, d; Status() {} Status(int dd, int xx, int yy,...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const string ds = "URDL"; const int dx[4] = {0, 1, 0, -1}; const int dy[4] = {-1, 0, 1, 0}; int n, m; vector<string> g; struct AhoCorasick { static const int alph_size = 26; struct node_t { int parent, suffLink; char charFromParent; int children[alph_size]; ...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
python3
from heapq import heappush, heappop from collections import deque def main(): while True: n, m = map(int, input().split()) if n == 0:break mp = ["#" * (m + 2)] + ["#" + input() + "#" for _ in range(n)] + ["#" * (m + 2)] for y in range(1, n + 1): for x in range(1, m + 1): if mp[y][x] == ...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; enum DIR { North, East, South, West, }; struct Node { int num, parent_id, children[4], suffix_link, depth; bool finish_FLG; DIR pattern[10]; }; struct Data { void set(int arg_row, int arg_col) { row = arg_row; col = arg_col; } int row, col; }; st...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <typename T> struct Maybe { T val; bool valid; Maybe() : valid(false) {} Maybe(T &t) : val(t), valid(true) {} T &operator=(const T &rv) { val = rv; valid = true; return val; } operator T() { return valid ? val : T(); } const T &fetch(con...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const string ds = "URDL"; const int dx[4] = {0, 1, 0, -1}; const int dy[4] = {-1, 0, 1, 0}; int n, m; vector<string> g; struct AhoCorasick { static const int max_n = 101; static const int alph_size = 128; struct node_t { int parent, suffLink; char charFromPare...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int tx[] = {0, 1, 0, -1}; int ty[] = {-1, 0, 1, 0}; static const double EPS = 1e-8; class Nodes { public: class Nodes* children[256]; bool has_word; Nodes() : has_word(false) { for (int i = 0; i < 256; i++) { children[i] = NULL; } } }; class Trie { p...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int m, n, nr, ns; string mat[53]; string rule[13]; int d[53][53][113]; int t[113][4]; string suf[113]; int dx[] = {-1, 0, 1, 0}; int dy[] = {0, 1, 0, -1}; char dc[] = {'U', 'R', 'D', 'L'}; struct Status { int x, y, s, d; Status() {} Status(int dd, int xx, int yy, int ...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; class AhoCorasick { static const int ASIZE = 256; struct node_t { int ID; node_t *failure; node_t *output; node_t *next[ASIZE]; std::vector<int> match; node_t(int id) : ID(id), failure(NULL), output(NULL) { std::fill(next, next + ASIZE, (no...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; struct Data { int cur, cost; pair<int, int> info; string debug; Data(int cur = (INT_MAX), int cost = (INT_MAX), pair<int, int> info = pair<int, int>((INT_MAX), (INT_MAX)), string debug = "$$$") : cur(cur), cost(cost), info(info), debug(debug) {} ...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; struct node { int proh; int to[4]; int fail; node() { proh = 0; memset(to, 0, sizeof to); fail = 0; } }; int w, h; char field[52][52]; vector<node> ac; int dx[] = {-1, 0, 1, 0}; int dy[] = {0, -1, 0, 1}; void addptn(const char *ptn) { int x = 1, f = ...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; struct NODE { int x, y, a, b, cost; NODE(int A, int B, int C, int D, int E) { x = A, y = B, a = C, b = D, cost = E; } }; int dx[] = {-1, 0, 1, 0}; int dy[] = {0, -1, 0, 1}; char dc[] = {'L', 'U', 'R', 'D'}; int main() { int W, H; while (cin >> H >> W, H) { ...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int tx[] = {0, 1, 0, -1}; int ty[] = {-1, 0, 1, 0}; static const double EPS = 1e-8; const static char dir[4] = {'U', 'R', 'D', 'L'}; const static string dir_str[4] = {"U", "R", "D", "L"}; class Nodes { public: class Nodes* children[256]; bool has_word; Nodes() : has_...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const string ds = "URDL"; const int dx[4] = {0, 1, 0, -1}; const int dy[4] = {-1, 0, 1, 0}; int n, m; vector<string> g; struct AhoCorasick { static const int alph_size = 26; struct node_t { int parent, suffLink; char charFromParent; int children[alph_size]; ...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int vy[] = {0, 1, 0, -1}, vx[] = {1, 0, -1, 0}; const string temp = "RDLU"; const int mask = (1 << 18) - 1; int H, W, P, sx, sy; string S[50], V[10]; bool bits[1 << 20]; int solve() { memset(bits, false, sizeof(bits)); for (int i = 0; i < P; i++) { int curr = ...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; char str[60][60]; char in[60]; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; char dc[7] = "DRUL"; int bfs[60][60][110]; string val[110]; int ng[110]; int main() { int a, b; while (scanf("%d%d", &a, &b), a) { for (int i = 0; i < a; i++) scanf("%s", str[i]); ...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; static const double EPS = 1e-9; static const double PI = acos(-1.0); struct Point { int x; int y; int cost; int str; Point(int x, int y, int cost, int str) : x(x), y(y), cost(cost), str(str) { ; } }; int w, h; char field[60][60]; char str[100]; const int dx[...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; enum DIR { North, East, South, West, }; struct Node { int num, parent_id, children[4], suffix_link, depth; bool finish_FLG; DIR pattern[10]; }; struct Data { void set(int arg_row, int arg_col) { row = arg_row; col = arg_col; } int row, col; }; st...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; static const double EPS = 1e-9; static const double PI = acos(-1.0); struct Point { int x; int y; int cost; int str; Point(int x, int y, int cost, int str) : x(x), y(y), cost(cost), str(str) { ; } }; int w, h, p; char field[60][60]; char str[100]; const int ...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int tx[] = {0, 1, 0, -1}; int ty[] = {-1, 0, 1, 0}; static const double EPS = 1e-8; const static char dir[4] = {'U', 'R', 'D', 'L'}; const static string dir_str[4] = {"U", "R", "D", "L"}; class Nodes { public: class Nodes* children[256]; bool has_word; Nodes() : has_...
p01329 Stolen Jewel
The jewel, a national treasure of the Kingdom of Pal, was stolen by bandits. As an adventurer, you heard the rumor and headed for the thief's hideout and managed to get the jewels back. However, when I went to return the jewel to the castle of the Kingdom of Pal, the guard of the castle said, "My king has not complete...
{ "input": [ "6 7\n.......\n...#...\n...#.S.\n...###.\n.G.....\n.......\n2\nLL\nDD", "7 6\n......\n.####.\n.####.\n...S#.\n...##.\n...##.\n.....G\n3\nLD\nDD\nLLL\n7 8\nS#......\n.#.####.\n.#.#G.#.\n.#.##.#.\n.#....#.\n.######.\n........\n8\nDDDD\nDDDU\nUUUU\nUUUD\nRRRR\nRRRL\nLLLL\nLLLR\n3 8\n\nS......G\n\n2\...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int tx[] = {0, 1, 0, -1}; int ty[] = {-1, 0, 1, 0}; static const double EPS = 1e-8; class Nodes { public: class Nodes* children[256]; bool has_word; Nodes() : has_word(false) { for (int i = 0; i < 256; i++) { children[i] = NULL; } } }; class Trie { p...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <iomanip> #include <sstream> #include <cstdio> #include <string> #include <vector> #include <algorithm> #include <complex> #include <cstring> #include <cstdlib> #include <cmath> #include <cassert> #include <climits> #include <queue> #include <set> #include <map> #include <valarray> #include...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) #define all(c) c.begin(),c.end() #define pb push_back #define fs first #define sc second #define show(x) cout << #x << " = " << x << endl #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) using...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
CORRECT
java
import java.util.*; class Main{ int h,w; char[][] sheet; ArrayList<Dice> list; ArrayList<Character> color; int[] colors; int[] dx = {0, 1, 0, -1}; int[] dy = {-1, 0, 1, 0}; int[][] nei = {{1, 3, 2, 4}, {5, 3, 0, 4}, {0, 3, 5, 4}, ...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
CORRECT
cpp
#include<stdio.h> #include<vector> #include<algorithm> using namespace std; char str[60][60]; int h[]={2,3,3,3,3,3,3,3,3,3,3}; int w[]={5,4,4,4,4,4,4,4,4,4,4}; char tkz[11][6][6]={ { "DLU..", "..FRB" }, { "U...", "FRBL", "D..." }, { "U...", "FRBL", ".D.." }, { "U...", "FRBL", "..D." }, { "U...", "FRBL", "...D" }, { ".U...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; // 0: top, 1: front, 2:right, 3:back, 4:left, 5:bottom const vector<vector<string>> dice_map = { {"0...", "1234", "5..."}, {"0...", "1234", ".5.."}, {"0...", "1234", "..5."}, {"0...", "1234", "...5"}, {".0..", ...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
CORRECT
cpp
#include <stdio.h> #include <string.h> #include <algorithm> #include <iostream> #include <math.h> #include <assert.h> #include <vector> #include <set> using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; static const double EPS = 1e-9; static const double PI = acos(-1.0...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define all(x) (x).begin(),(x).end() #define pb push_back #define fi first #define se second #define dbg(x) cout<<#x" = "<<((x))<<endl template<class T,class U> ostream& operator<<(ostream& o, const pa...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
CORRECT
python3
from collections import deque from string import ascii_lowercase, ascii_uppercase, digits import sys readline = sys.stdin.readline write = sys.stdout.write D = [ (1, 5, 2, 3, 0, 4), # 'U' (3, 1, 0, 5, 4, 2), # 'R' (4, 0, 2, 3, 5, 1), # 'D' (2, 1, 5, 0, 4, 3), # 'L' ] p_dice = (0, 0, 0, 1, 1, 2, 2, 3)*3...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
CORRECT
java
import java.util.*; class Main{ int h,w; char[][] sheet; ArrayList<Dice> list; ArrayList<Character> color; int[] colors; class Dice{ char[] dice = new char[6]; Dice(char f, char t, char b, char r, char l, char u){ dice[0] = f; dice[1] = t; ...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define HUGE_NUM 99999999999999999 #define MOD 1000000007 #define EPS 0.000000001 using namespace std; struct LOC{ LOC(int arg_row,int arg_col){ row = arg_row; col = arg_col; } int row,col; }; //0:...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> using namespace std; using Int = long long; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} struct Dice{ int s[6]; void roll(char c){ //the view from above // N //W E ...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int INF = 1 << 29; const double PI = acos(-1); const double EPS = 1e-8; const int dy[4] = {-1, 0, 1, 0}; const int dx[4] = {0, 1, 0, -1}; template <class T> struct dice { T t, b, n, s, e, w; int x, y; dice() { t = ' '; } dice(int y, int x) : y(y), x(x) { t = 0...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T, class U> ostream& operator<<(ostream& o, const pair<T, U>& p) { o << "(" << p.first << "," << p.second << ")"; return o; } template <class T> ostream& operator<<(ostream& o, const vector<T>& v) { o << "["; for (T t : v) { ...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
IN-CORRECT
java
import java.util.*; class Main{ int h,w; char[][] sheet; ArrayList<Dice> list; ArrayList<Character> color; int[] colors; int[] dx = {0, 1, 0, -1}; int[] dy = {-1, 0, 1, 0}; int[][] nei = {{1, 3, 2, 4}, {5, 3, 0, 4}, {0, 3, 5, 4}, ...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
IN-CORRECT
java
import java.util.*; class Main{ int h,w; char[][] sheet; ArrayList<Dice> list; ArrayList<Character> color; int[] colors; int[] dx = {0, 1, 0, -1}; int[] dy = {-1, 0, 1, 0}; int[][] nei = {{1, 3, 2, 4}, {5, 3, 0, 4}, {0, 3, 5, 4}, ...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T, class U> ostream& operator<<(ostream& o, const pair<T, U>& p) { o << "(" << p.first << "," << p.second << ")"; return o; } template <class T> ostream& operator<<(ostream& o, const vector<T>& v) { o << "["; for (T t : v) { ...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
IN-CORRECT
java
import java.util.*; class Main{ int h,w; char[][] sheet; ArrayList<Dice> list; ArrayList<Character> color; int[] colors; int[] dx = {0, 1, 0, -1}; int[] dy = {-1, 0, 1, 0}; int[][] nei = {{1, 3, 2, 4}, {5, 3, 0, 4}, {0, 3, 5, 4}, ...
p01496 Bicube
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube here refers to a cube of which each face consists of one square. She is...
{ "input": [ "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a....f....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#.\n.#....#....#....#....#....#....#....#...", "3 40\n.a....a....a....a......
{ "input": [], "output": [] }
IN-CORRECT
java
import java.util.*; class Main{ int h,w; char[][] sheet; ArrayList<Dice> list; ArrayList<Character> color; int[] colors; int[] dx = {0, 1, 0, -1}; int[] dy = {-1, 0, 1, 0}; int[][] nei = {{1, 3, 2, 4}, {5, 3, 0, 4}, {0, 3, 5, 4}, ...
p01664 Sigma
I-σ A permutation of magnitude N is a sequence of elements in a sequence (1, 2, 3,…, N). For example, (5, 2, 1, 4, 3) is a permutation of size 5, while (1, 5, 1, 2, 3) is not. This problem is a reactive task. You play a response program and a "permutation guessing game". First of all, the response program internally ...
{ "input": [ "" ], "output": [ "" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<stdio.h> #include<algorithm> using namespace std; int p[500]; int q[250][500]; int r[250][500]; int ret[500]; int s[500]; int t[250][500]; int u[500]; int v[250][500]; int w[250][500]; int ABS(int a){return max(a,-a);} int LIM=240; int main(){ int a; scanf("%d",&a); for(int i=0;i<a;i++)p[i]=i; for(int i=0;...
p01664 Sigma
I-σ A permutation of magnitude N is a sequence of elements in a sequence (1, 2, 3,…, N). For example, (5, 2, 1, 4, 3) is a permutation of size 5, while (1, 5, 1, 2, 3) is not. This problem is a reactive task. You play a response program and a "permutation guessing game". First of all, the response program internally ...
{ "input": [ "" ], "output": [ "" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int p[500]; int q[250][500]; int r[250][500]; int ret[500]; int s[500]; int t[250][500]; int u[500]; int ABS(int a) { return max(a, -a); } int LIM = 240; int main() { int a; scanf("%d", &a); for (int i = 0; i < a; i++) p[i] = i; for (int i = 0; i < LIM; i++) { r...
p01664 Sigma
I-σ A permutation of magnitude N is a sequence of elements in a sequence (1, 2, 3,…, N). For example, (5, 2, 1, 4, 3) is a permutation of size 5, while (1, 5, 1, 2, 3) is not. This problem is a reactive task. You play a response program and a "permutation guessing game". First of all, the response program internally ...
{ "input": [ "" ], "output": [ "" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int p[500]; int q[250][500]; int r[250][500]; int ret[500]; int s[500]; int t[250][500]; int u[500]; int ABS(int a) { return max(a, -a); } int LIM = 3; int main() { int a; scanf("%d", &a); for (int i = 0; i < a; i++) p[i] = i; for (int i = 0; i < LIM; i++) { ran...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using VI = vector<int>; using VVI = vector<VI>; using PII = pair<int, int>; using LL = long long; using VL = vector<LL>; using VVL = vector<VL>; using PLL = pair<LL, LL>; using VS = vector<string>; #define ALL(a) begin((a)),end((a)) #define RALL(a) (a).rbegin(), (a).rend...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1180 #include <iostream> #include <string> #include <vector> #include <set> #include <map> #include <cmath> #include <algorithm> #include <iomanip> #include <queue> using ll = long long; using namespace std; int const MOD = 1e9 + 7; int GCD(int x, int y) { ...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> #define range(i,a,b) for(int i = (a); i < (b); i++) #define rep(i,b) for(int i = 0; i < (b); i++) #define all(a) (a).begin(), (a).end() #define debug(x) cout << "debug " << x << endl; const int INF = 100000000; using namespace std; //?????§??¬?´???° int gcd(int x, int y) { int r; if(x ...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#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) ...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.PrintWriter; import java.util.*; public class Main { private static long gcd(long a, long b) { if ( a== 0)return b; return gcd(b % a, a); } public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include "bits/stdc++.h" #include<unordered_map> #include<unordered_set> #pragma warning(disable:4996) using namespace std; long long int gcd(long long int l, long long int r) { if (l > r)return gcd(r, l); else { if (r%l) { return gcd(l, r%l); } else { return l; } } } map<long long int, int>soinnsuu(...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { int p, q; cin >> p >> q; int g = gcd(p, q); p /= g; q /= g; int ans = 1; for (int i = 2; i * i <= q; i++) { if (q % i != 0) continue; while (q % i == 0) { q /= i; } ans *= i; ...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; int gcd(int x, int y) { return y == 0 ? x : gcd(y, x%y); } int P, Q; int main() { cin >> P >> Q; int v = Q / gcd(P, Q); for (int d = 2; d*d <= v; ++d) { if (v % d == 0) { while ((v/d)%d == 0) { v /= d; } } } cout << max(2, v...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #define MAX_N 1000000000 int gcd(int a, int b) { if (a < b) return gcd(b, a); else if (a % b) return gcd(b, a % b); else return b; } int main() { int p, q; cin >> p >> q; q /= gcd(p, q); map<int, int> res; for (int i =...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; typedef pair<int ,P> P3; typedef pair<P ,P> PP; const ll MOD = ll(1e9+7); const int IINF = INT_MAX; const ll LLINF = LLONG_MAX; const int MAX_N = int(1e5 + 5); const double EPS = 1e-6; const int...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
python3
def gcd(m, n): r = m % n return gcd(n, r) if r else n p, q = map(int, input().split()) q //= gcd(p, q) x = q; y = 1; k = 2 while k*k <= x: if x % k == 0: while x % k == 0: x //= k y *= k k += 1 y *= x print(y)
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> using namespace std; int gcd(int a, int b) { return b == 0 ? a : gcd(b, a%b); } int main() { vector<int> prime; vector<bool> is_prime(1e5, true); is_prime[0] = is_prime[1] = false; for(int i=2; i<1e5; ++i) { if(is_prime[i]) { prime.push_bac...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; int gcd(int u, int v){ while(v!=0){ int r = u%v; u = v; v = r; } return u; } int main(){ int p,q; cin >> p >> q; q /= gcd(p,q); int ans=1; int rq=q; for(int i=2; i*i<=q; i++){ if(rq%i==0){ ans*=i; } while(rq%i==0){ rq/=i; } } ans *= rq; cout <...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <numeric> #include <stack> #include <queue> #include <map> #include <set> #include <utility> #include <sstream> #include <complex> #include <fstream> #include <bitset> #include ...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> using namespace std; #define int long long typedef pair<int,int>pint; typedef vector<int>vint; typedef vector<pint>vpint; #define pb push_back #define mp make_pair #define fi first #define se second #define all(v) (v).begin(),(v).end() #define rep(i,n) for(int i=0;i<(n);i++) #define reps(i,f,n...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<algorithm> #include<string> #include<cstdlib> #include<map> #include<iomanip> #include<sstream> #include<vector> #include<stack> #include<math.h> #include<queue> #include<complex> #include<random> #include<ctime> #include<set> using namespace std; const long long int mod=1000000007; const ...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<vector> #include<string> #include<algorithm> #include<map> #include<set> #include<utility> #include<cmath> #include<cstring> #include<queue> #include<stack> #include<cstdio> #include<sstream> #include<iomanip> #include<assert.h> #define loop(i,a,b) for(int i=a;i<b;i++) #define rep(i,a) loo...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
python3
import fractions a,b=map(int,input().split()) b//=fractions.gcd(a,b) a,c=2,1 while a**2<=b: if b%a==0: c*=a while b%a==0: b//=a a+=1 print(c*b)
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++) #define REP(i,n) FOR(i,0,n) #define ALL(a) a.begin(), a.end() #define MS(m,v) memset(m,v,sizeof(m)) typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<string> vs; typedef pair<int,...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <fstream> #include <sstream> #include <string> #include <cstring> #include <vector> #include <set> #include <map> #include <unordered_map> #include <queue> #include <deque> #include <stack> #include <algorithm> #include <bitset> #include <cmath> #include <cstdlib> #include <ctime> #include ...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> #include <math.h> using namespace std; int gcd(int a, int b){ int temp1 = a, temp2 = b; if (temp1 < temp2){ int temp; temp = temp1; temp1 = temp2; temp2 = temp; } if(temp2 == 0) return temp1; return gcd(temp2, temp1%temp2); } int main(){ int p, q, m; cin >> p >> q;...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
/* main code starts from line 155. */ /* ---------- STL Libraries ---------- */ // IO library #include <cstdio> #include <iomanip> #include <ios> #include <iostream> // algorithm library #include <algorithm> #include <cmath> #include <numeric> // container library #include <array> #include <bitset> #include <map> #...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> using namespace std; int gcd(int a, int b){ return b == 0 ? a : gcd(b, a%b); } int main(){ int p, q; cin >> p >> q; int g = gcd(p, q); p /= g, q /= g; int ans = 1; for(int i = 2; i*i <= q; i++){ if(q % i == 0){ ans *= i; while(q % i ...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<stdio.h> #include<math.h> int gcd(int a,int b){ if(a < b){ int c = a; a = b; b = c; } if(a % b == 0) return b; return gcd(b,a % b); } bool judgeprime(int n){ if(n == 1 || n % 2 == 0) return false; int i,j; j = (int)sqrt(n) + 1; bool k =...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<cstdio> #include<algorithm> #include<cmath> int era[100000]; using namespace std; int main(void) { int p,q,i,j,kou,x,a,b,suu,flg; scanf("%d %d",&p,&q); a=q; b=p; while(1) { x=a%b; if(x==0) break; a=b; b=x; } for(i=2;i<=100000;i++) era[i]=1; for(i=2;i*i<=100000;i++) { if(era[i]==1) { for(j=2...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #define llint long long using namespace std; llint p, q; bool prime[100005]; llint gcd(llint a, llint b) { if(b == 0) return a; return gcd(b, a%b); } int main(void) { cin >> p >> q; llint g = gcd(p, q); p /= g, q /= g; for(int i = 2; i < 1005; i++){ if(prime[i]) continue; for(int j...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.*; import java.io.*; import java.awt.geom.*; import java.math.*; public class Main { static final Scanner in = new Scanner(System.in); static final PrintWriter out = new PrintWriter(System.out,false); static boolean debug = false; static int gcd(int a, int b) { if (a == 0) return b; return g...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#define _CRT_SECURE_NO_WARNINGS #pragma comment (linker, "/STACK:526000000") #include "bits/stdc++.h" using namespace std; typedef string::const_iterator State; #define eps 1e-11L #define MAX_MOD 1000000007LL #define GYAKU 500000004LL #define MOD 998244353LL #define seg_size 262144*2LL #define pb push_back #define ...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <map> #include <cmath> using namespace std; int euclid(int x, int y){ int t; while (x % y){ x %= y; t = x; x = y; y = t; } return y; } int main(){ int p, q, n, m, t = 2, ans = 1; cin >> p >> q; n = q / euclid(p, q); m = n; map<int, int> f; while (n > 1 && t < sqrt(m) + 1)...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; public class Main { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new ...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import static java.lang.Integer.parseInt; /** * Let's Solve Geometric Problems */ public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReade...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstdio> #include <cmath> #include <cstdio> #include <cstring> #include <string> #include <vector> #include <set> #include <map> #include <algorithm> #define CH(N,A,B) (A<=N&&N<B) #define REP(i,a,b) for(int i=a;i<b;i++) #define RREP(i,a,b) for(int i=(b-1);a<=i;i--) using namespace std; i...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <iomanip> #include <algorithm> #include <string> #include <cstdio> #include <cmath> #include <cstdlib> #include <cstring> #include <vector> #include <list> #include <map> #include <set> #include <queue> #include <stack> using std::cin; using std::cout; using std::endl; using std::setprecis...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; long long GCD(long long a, long long b) { if (b == 0) return a; else return GCD(b, a % b); } int main() { long long p, q; cin >> p >> q; long long d = GCD(p, q); q /= d; for (long long v = 2; v*v <= q; ++v) { while (q % (v*v)== 0) q /= v; } ...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <algorithm> #include <cmath> #include <climits> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <cassert> #include <func...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> using namespace std; int gcd(int x, int y) { return y == 0 ? x : gcd(y, x%y); } int main() { int p, q, r=1; cin >> p >> q; q = q / gcd(q, p); for (int i = 2; i*i <= q; ++i) { if (q%i == 0) { r *= i; while (q%i == 0) q /= i; } } cout << r * q << endl; }
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.util.NoSuchElementException; public class Main { static PrintWriter out; static InputReader ir; static void solve() { int p = ir.nextInt(); if(p==0)...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <cmath> #define REP(i,a,b) for(int i=int(a);i<int(b);i++) using namespace std; typedef long long int lli; lli gcd(lli a, lli b) { if (b == 0) return a; return gcd(b, a % b); } int main () { lli p, q; cin >> p >> q; ...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<cstdio> #include<algorithm> #include<string> #include<vector> #include<queue> #include<set> #include<functional> #include<map> using namespace std; int gcd(int a, int b) { if (b == 0)return a; return gcd(b, a%b); } int main() { int a, b; cin >> a >> b; b = b / gcd(a, b); a = b; int c =...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.*; import java.io.*; public class Main{ public static void main(String[] args){ solve(); } public static void solve(){ Scanner sc = new Scanner(System.in); int p = sc.nextInt(); int q = sc.nextInt(); if(q%p==0){ q /= p; p = 1; } boolean[] judge = new boolean[(int)Math.sqrt(10000...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include "bits/stdc++.h" #define REP(i, n, N) for(ll i=(n); i<(N); i++) #define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--) #define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr) #define CK(n, a, b) ((a)<=(n)&&(n)<(b)) #define ALL(v) (v).begin(),(v).end() #define MCP(a, b) memcpy(b,a,sizeof(b)) #def...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> using namespace std; int main(){ int p,q,use; int so[40000]={0}; cin>>p>>q; use=q; int a; while(q%p!=0){ a=q%p; q=p; p=a; } use/=p; q=use; vector <int> sonaka; for(int i=2;i<40000;i++) if(so[i]==0){ sonaka.push_back(i); for(int j=i*2;...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; // calculate |gcd|. // if ether num is 0, return 0 long long GCD(long long left, long long right) { if(left == 0 || right == 0) return 0; if(left < 0) left *= -1; if(right < 0) right *= -1; if(left < right) swap(left, right); long long nextnum, ansgcd = -1; wh...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> #define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++) using namespace std; typedef long long ll; int P, Q; bool p[100000]; vector<int> v; int gcd(int a, int b) { if(b == 0) return a; return gcd(b, a % b); } bool prime(int n) { REP(i, 0, v.size()) if(n % v[i] == 0...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <map> #include <cmath> using namespace std; int euclid(int x, int y){ int t; while (x % y){ x %= y; t = x; x = y; y = t; } return y; } int main(){ int p, q, n, m, t = 2, ans = 1; cin >> p >> q; n = q / euclid(p, q); m = n; map<int, int> f; while (n > 1 && t < sqrt(m) + 1)...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; // a>b int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a%b); } int main() { int p, q; cin >> p >> q; q /= gcd(p, q); int ans = 1; for (int i = 2; i*i <= q; i++) { if (q%i == 0) { ans *= i; while (q%i == 0) q /= i; } } cout << ans*q << endl;; ...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.HashSet; import java.util.NoSuchElementException; public class Main { int P,Q; HashSet<Integer> set; public void setFactors(int n) { set = new HashSet<Integer>(); for(int j = 2;(long)j * j <= n;j++){ while(n...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> #define rep(i,n)for(int i=0;i<n;i++) using namespace std; int gcd(int a, int b) { if (!b)return a; return gcd(b, a%b); } int main() { int p, q; cin >> p >> q; q /= gcd(p, q); map<int, int>m; for (int i = 2; i*i <= q; i++) { while (q%i == 0) { m[i]++; q /= i; } } if (q != 1)m[q] = 1...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> using namespace std; using ll = long long; using VI = vector<ll>; using VV = vector<VI>; using VS = vector<string>; using PII = pair<ll, ll>; // tourist set template <typename A, typename B> string to_string(pair<A, B> p); template <typename A, typename B, typename C> string to_string(tuple<A,...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <stdio.h> #include <math.h> int gcd(int a, int b) { int t; while(b) { t = a % b; a = b; b = t; } return a; } int main(void){ int p, q, i, j, ans = 1, bef = 0; scanf("%d%d", &p, &q); q /= gcd(p, q); for(i = 2; i <= sqrt(q) + 1;) { if(!(q % i)) { if(bef != i) ans *= i, bef...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
python3
import math p,q=map(int,input().split()) q//=math.gcd(p,q) i=2 a=1 while i*i<=q: if q%i==0: a*=i while q%i==0: q//=i i+=1 print(a*q)
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> using namespace std; int main(){ int p,q,use; int so[40000]={0}; cin>>p>>q; use=q; int a; while(q%p){ a=q%p; q=p; p=a; } use/=p; vector <int> sonaka; for(int i=2;i<40000;i++) if(!so[i]){ sonaka.push_back(i); for(int j=i*2;j<40000;j+=i) ...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> using namespace std; #define N 1000000000 typedef long long int ll; ll gcd(ll a,ll b){ if(b==0)return a; else return gcd(b,a%b); } queue<ll> q; vector<bool> prime(N+1,true); void make(ll M){ prime[0]=prime[1]=false; ll i; for( i=2;i*i<=M+1;i++){ if(prime[i]){ ll j=2; q.push(i); while(i...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using vi=vector<int>; using vvi=vector<vi>; using vs=vector<string>; using msi=map<string,int>; using mii=map<int,int>; using pii=pair<int,int>; using vlai=valarray<int>; using ll=long long; #define rep(i,n) for(int i=0;i<n;i++) #define range(i,s,n) for(int i=s;i<n;i++) #...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<cstdio> #include<cstring> long long int gcd(long long int p, long long int q) { if(!q) return p; if(q>p) return gcd(q, p); return gcd(q, p%q); } int main(void) { long long int p,q; scanf("%lld%lld",&p,&q); long long int g = gcd(p,q); p/=g; q/=g; long long int b=1; for(lon...
p01809 Let's Solve Geometric Problems
Let's solve the geometric problem Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems. Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in...
{ "input": [ "1 2" ], "output": [ "2" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = int64_t; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } int main() { ll P, Q; cin >> P >> Q; ll G = gcd(P, Q); Q /= G; ll ans = 1; ll QQ = Q; for(ll i = 2; i * i <= Q; i++) { ll cnt = 0; while(QQ % i == 0) { ...