Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed because of a cast error
Error code:   DatasetGenerationCastError
Exception:    DatasetGenerationCastError
Message:      An error occurred while generating the dataset

All the data files must have the same columns, but at some point there are 2 new columns ({'Java', 'Cpp'}) and 7 missing columns ({'Kuin', 'Ruby', 'Go', 'C++', 'Python', 'Crystal', 'Rust'}).

This happened while the json dataset builder was generating data using

hf://datasets/puwaer/puwaer_code_translation/kyopro_codes_cpp_java.json (at revision 36699897bb89deae6ba5dff622d167b37730d160)

Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1871, in _prepare_split_single
                  writer.write_table(table)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/arrow_writer.py", line 623, in write_table
                  pa_table = table_cast(pa_table, self._schema)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2293, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2241, in cast_table_to_schema
                  raise CastError(
              datasets.table.CastError: Couldn't cast
              id: int64
              name: string
              Cpp: string
              Java: string
              -- schema metadata --
              pandas: '{"index_columns": [], "column_indexes": [], "columns": [{"name":' + 534
              to
              {'id': Value(dtype='int64', id=None), 'name': Value(dtype='string', id=None), 'C++': Value(dtype='string', id=None), 'Crystal': Value(dtype='string', id=None), 'Python': Value(dtype='string', id=None), 'Go': Value(dtype='string', id=None), 'Rust': Value(dtype='string', id=None), 'Kuin': Value(dtype='string', id=None), 'Ruby': Value(dtype='string', id=None)}
              because column names don't match
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1438, in compute_config_parquet_and_info_response
                  parquet_operations = convert_to_parquet(builder)
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1050, in convert_to_parquet
                  builder.download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 925, in download_and_prepare
                  self._download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1001, in _download_and_prepare
                  self._prepare_split(split_generator, **prepare_split_kwargs)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1742, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1873, in _prepare_split_single
                  raise DatasetGenerationCastError.from_cast_error(
              datasets.exceptions.DatasetGenerationCastError: An error occurred while generating the dataset
              
              All the data files must have the same columns, but at some point there are 2 new columns ({'Java', 'Cpp'}) and 7 missing columns ({'Kuin', 'Ruby', 'Go', 'C++', 'Python', 'Crystal', 'Rust'}).
              
              This happened while the json dataset builder was generating data using
              
              hf://datasets/puwaer/puwaer_code_translation/kyopro_codes_cpp_java.json (at revision 36699897bb89deae6ba5dff622d167b37730d160)
              
              Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

id
int64
name
string
C++
string
Crystal
string
Python
string
Go
string
Rust
string
Kuin
string
Ruby
null
1
001
#include <iostream> using namespace std; long long N, K, L; long long A[1 << 18]; bool solve(long long M) { long long cnt = 0, pre = 0; for (int i = 1; i <= N; i++) { if (A[i] - pre >= M && L - A[i] >= M) { cnt += 1; pre = A[i]; } } if (cnt >= K) r...
_, l = read_line.split.map(&.to_i) k = read_line.to_i a = read_line.split.map(&.to_i) + [l] puts (1..10**9).bsearch { |len| last, cnt = 0, 0 a.each do |i| if i - last >= len cnt += 1 last = i end end cnt < k + 1 }.not_nil! - 1
null
null
null
null
null
2
001
#include <iostream> using namespace std; long long N, K, L; long long A[1 << 18]; bool solve(long long M) { long long cnt = 0, pre = 0; for (int i = 1; i <= N; i++) { if (A[i] - pre >= M && L - A[i] >= M) { cnt += 1; pre = A[i]; } } if (cnt >= K) r...
null
n, l = map(int,input().split()) k = int(input()) a = list(map(int,input().split())) a.append(l) dif = [a[0]] # 切り口の差を計算 for i in range(n): dif.append(a[i + 1] - a[i]) def is_ok(x): length = 0 cnt = 0 for i in dif: length += i if length >= x: length = 0 cnt += 1 ...
null
null
null
null
3
001
#include <iostream> using namespace std; long long N, K, L; long long A[1 << 18]; bool solve(long long M) { long long cnt = 0, pre = 0; for (int i = 1; i <= N; i++) { if (A[i] - pre >= M && L - A[i] >= M) { cnt += 1; pre = A[i]; } } if (cnt >= K) r...
null
null
package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func main() { buf := make([]byte, 1024*1024) sc.Buffer(buf, bufio.MaxScanTokenSize) sc.Split(bufio.ScanWords) n, l := ScanInt(), ScanInt() k := ScanInt() a := ScanIntSlice(n) ok, ng := 0, l check := func(x int) bo...
null
null
null
4
001
#include <iostream> using namespace std; long long N, K, L; long long A[1 << 18]; bool solve(long long M) { long long cnt = 0, pre = 0; for (int i = 1; i <= N; i++) { if (A[i] - pre >= M && L - A[i] >= M) { cnt += 1; pre = A[i]; } } if (cnt >= K) r...
null
null
null
fn main() { proconio::input! { n: isize, l: isize, k: isize, mut a: [isize; n] } a.sort(); let mut ok = 0; let mut ng = l + 1; while (ng - ok).abs() > 1 { let mid = (ok + ng) / 2; if is_ok(&a, l, k, mid) { ok = mid; } else { ...
null
null
5
001
#include <iostream> using namespace std; long long N, K, L; long long A[1 << 18]; bool solve(long long M) { long long cnt = 0, pre = 0; for (int i = 1; i <= N; i++) { if (A[i] - pre >= M && L - A[i] >= M) { cnt += 1; pre = A[i]; } } if (cnt >= K) r...
null
null
null
null
func main() var n: int :: cui@inputInt() var l: int :: cui@inputInt() var k: int :: cui@inputInt() var a: []int :: #[n + 1]int for i(0, n - 1) do a[i] :: cui@inputInt() end for do a[n] :: l var ok: int :: 0 var ng: int :: l + 1 while((ok - ng).abs() > 1) var mid: int :: (ok + ng) / 2 var prev: int :: ...
null
6
001
null
_, l = read_line.split.map(&.to_i) k = read_line.to_i a = read_line.split.map(&.to_i) + [l] puts (1..10**9).bsearch { |len| last, cnt = 0, 0 a.each do |i| if i - last >= len cnt += 1 last = i end end cnt < k + 1 }.not_nil! - 1
n, l = map(int,input().split()) k = int(input()) a = list(map(int,input().split())) a.append(l) dif = [a[0]] # 切り口の差を計算 for i in range(n): dif.append(a[i + 1] - a[i]) def is_ok(x): length = 0 cnt = 0 for i in dif: length += i if length >= x: length = 0 cnt += 1 ...
null
null
null
null
7
001
null
_, l = read_line.split.map(&.to_i) k = read_line.to_i a = read_line.split.map(&.to_i) + [l] puts (1..10**9).bsearch { |len| last, cnt = 0, 0 a.each do |i| if i - last >= len cnt += 1 last = i end end cnt < k + 1 }.not_nil! - 1
null
package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func main() { buf := make([]byte, 1024*1024) sc.Buffer(buf, bufio.MaxScanTokenSize) sc.Split(bufio.ScanWords) n, l := ScanInt(), ScanInt() k := ScanInt() a := ScanIntSlice(n) ok, ng := 0, l check := func(x int) bo...
null
null
null
8
001
null
_, l = read_line.split.map(&.to_i) k = read_line.to_i a = read_line.split.map(&.to_i) + [l] puts (1..10**9).bsearch { |len| last, cnt = 0, 0 a.each do |i| if i - last >= len cnt += 1 last = i end end cnt < k + 1 }.not_nil! - 1
null
null
fn main() { proconio::input! { n: isize, l: isize, k: isize, mut a: [isize; n] } a.sort(); let mut ok = 0; let mut ng = l + 1; while (ng - ok).abs() > 1 { let mid = (ok + ng) / 2; if is_ok(&a, l, k, mid) { ok = mid; } else { ...
null
null
9
001
null
_, l = read_line.split.map(&.to_i) k = read_line.to_i a = read_line.split.map(&.to_i) + [l] puts (1..10**9).bsearch { |len| last, cnt = 0, 0 a.each do |i| if i - last >= len cnt += 1 last = i end end cnt < k + 1 }.not_nil! - 1
null
null
null
func main() var n: int :: cui@inputInt() var l: int :: cui@inputInt() var k: int :: cui@inputInt() var a: []int :: #[n + 1]int for i(0, n - 1) do a[i] :: cui@inputInt() end for do a[n] :: l var ok: int :: 0 var ng: int :: l + 1 while((ok - ng).abs() > 1) var mid: int :: (ok + ng) / 2 var prev: int :: ...
null
10
001
null
null
n, l = map(int,input().split()) k = int(input()) a = list(map(int,input().split())) a.append(l) dif = [a[0]] # 切り口の差を計算 for i in range(n): dif.append(a[i + 1] - a[i]) def is_ok(x): length = 0 cnt = 0 for i in dif: length += i if length >= x: length = 0 cnt += 1 ...
package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func main() { buf := make([]byte, 1024*1024) sc.Buffer(buf, bufio.MaxScanTokenSize) sc.Split(bufio.ScanWords) n, l := ScanInt(), ScanInt() k := ScanInt() a := ScanIntSlice(n) ok, ng := 0, l check := func(x int) bo...
null
null
null
11
001
null
null
n, l = map(int,input().split()) k = int(input()) a = list(map(int,input().split())) a.append(l) dif = [a[0]] # 切り口の差を計算 for i in range(n): dif.append(a[i + 1] - a[i]) def is_ok(x): length = 0 cnt = 0 for i in dif: length += i if length >= x: length = 0 cnt += 1 ...
null
fn main() { proconio::input! { n: isize, l: isize, k: isize, mut a: [isize; n] } a.sort(); let mut ok = 0; let mut ng = l + 1; while (ng - ok).abs() > 1 { let mid = (ok + ng) / 2; if is_ok(&a, l, k, mid) { ok = mid; } else { ...
null
null
12
001
null
null
n, l = map(int,input().split()) k = int(input()) a = list(map(int,input().split())) a.append(l) dif = [a[0]] # 切り口の差を計算 for i in range(n): dif.append(a[i + 1] - a[i]) def is_ok(x): length = 0 cnt = 0 for i in dif: length += i if length >= x: length = 0 cnt += 1 ...
null
null
func main() var n: int :: cui@inputInt() var l: int :: cui@inputInt() var k: int :: cui@inputInt() var a: []int :: #[n + 1]int for i(0, n - 1) do a[i] :: cui@inputInt() end for do a[n] :: l var ok: int :: 0 var ng: int :: l + 1 while((ok - ng).abs() > 1) var mid: int :: (ok + ng) / 2 var prev: int :: ...
null
13
001
null
null
null
package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func main() { buf := make([]byte, 1024*1024) sc.Buffer(buf, bufio.MaxScanTokenSize) sc.Split(bufio.ScanWords) n, l := ScanInt(), ScanInt() k := ScanInt() a := ScanIntSlice(n) ok, ng := 0, l check := func(x int) bo...
fn main() { proconio::input! { n: isize, l: isize, k: isize, mut a: [isize; n] } a.sort(); let mut ok = 0; let mut ng = l + 1; while (ng - ok).abs() > 1 { let mid = (ok + ng) / 2; if is_ok(&a, l, k, mid) { ok = mid; } else { ...
null
null
14
001
null
null
null
package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func main() { buf := make([]byte, 1024*1024) sc.Buffer(buf, bufio.MaxScanTokenSize) sc.Split(bufio.ScanWords) n, l := ScanInt(), ScanInt() k := ScanInt() a := ScanIntSlice(n) ok, ng := 0, l check := func(x int) bo...
null
func main() var n: int :: cui@inputInt() var l: int :: cui@inputInt() var k: int :: cui@inputInt() var a: []int :: #[n + 1]int for i(0, n - 1) do a[i] :: cui@inputInt() end for do a[n] :: l var ok: int :: 0 var ng: int :: l + 1 while((ok - ng).abs() > 1) var mid: int :: (ok + ng) / 2 var prev: int :: ...
null
15
001
null
null
null
null
fn main() { proconio::input! { n: isize, l: isize, k: isize, mut a: [isize; n] } a.sort(); let mut ok = 0; let mut ng = l + 1; while (ng - ok).abs() > 1 { let mid = (ok + ng) / 2; if is_ok(&a, l, k, mid) { ok = mid; } else { ...
func main() var n: int :: cui@inputInt() var l: int :: cui@inputInt() var k: int :: cui@inputInt() var a: []int :: #[n + 1]int for i(0, n - 1) do a[i] :: cui@inputInt() end for do a[n] :: l var ok: int :: 0 var ng: int :: l + 1 while((ok - ng).abs() > 1) var mid: int :: (ok + ng) / 2 var prev: int :: ...
null
16
002
// this problem was so fun :) #include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; #define fs(n) fixed << setprecision(n); #define mp(a, b) make_pair(a, b); using ll = long long; using ld = long double; int n; int l = 0, r = 0; vector<string> anslist; /* if X is correct br...
n = read_line.to_i ['(', ')'].each_repeated_permutation(n, true) { |s| a = s.reduce([0]) { |acc, c| acc << acc[-1] + (c == '(' ? 1 : -1) } if a[-1] == 0 && a.all? { |i| i >= 0 } puts s.join end }
null
null
null
null
null
17
002
// this problem was so fun :) #include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; #define fs(n) fixed << setprecision(n); #define mp(a, b) make_pair(a, b); using ll = long long; using ld = long double; int n; int l = 0, r = 0; vector<string> anslist; /* if X is correct br...
null
from itertools import product n = int(input()) ans = [] if n % 2 == 0: # 奇数のときは正しいカッコ列を生成できない for i in product([0, 1], repeat = n): # 0 -> ( , 1 -> ) if i.count(1) == n // 2: # 0, 1の個数が同じ時に判定を始める zero_count = 0 Bool = True word = "" for j in range(len(i)): ...
null
null
null
null
18
002
// this problem was so fun :) #include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; #define fs(n) fixed << setprecision(n); #define mp(a, b) make_pair(a, b); using ll = long long; using ld = long double; int n; int l = 0, r = 0; vector<string> anslist; /* if X is correct br...
null
null
null
null
null
null
19
002
// this problem was so fun :) #include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; #define fs(n) fixed << setprecision(n); #define mp(a, b) make_pair(a, b); using ll = long long; using ld = long double; int n; int l = 0, r = 0; vector<string> anslist; /* if X is correct br...
null
null
null
null
func main() var n: int :: cui@inputInt() if(n % 2 <> 0) do cui@print("\n") ret end if for i(0, 2 ^ n - 1) var id: int :: i var cntOpen: int :: 0 var cntClose: int :: 0 var a: []bool :: #[n]bool for j(0, n - 1) do a[j] :: id % 2 = 1 if(a[j]) do cntOpen :+ 1 if(cntOpen > n / 2) skip...
null
20
002
null
n = read_line.to_i ['(', ')'].each_repeated_permutation(n, true) { |s| a = s.reduce([0]) { |acc, c| acc << acc[-1] + (c == '(' ? 1 : -1) } if a[-1] == 0 && a.all? { |i| i >= 0 } puts s.join end }
from itertools import product n = int(input()) ans = [] if n % 2 == 0: # 奇数のときは正しいカッコ列を生成できない for i in product([0, 1], repeat = n): # 0 -> ( , 1 -> ) if i.count(1) == n // 2: # 0, 1の個数が同じ時に判定を始める zero_count = 0 Bool = True word = "" for j in range(len(i)): ...
null
null
null
null
21
002
null
n = read_line.to_i ['(', ')'].each_repeated_permutation(n, true) { |s| a = s.reduce([0]) { |acc, c| acc << acc[-1] + (c == '(' ? 1 : -1) } if a[-1] == 0 && a.all? { |i| i >= 0 } puts s.join end }
null
null
null
null
null
22
002
null
n = read_line.to_i ['(', ')'].each_repeated_permutation(n, true) { |s| a = s.reduce([0]) { |acc, c| acc << acc[-1] + (c == '(' ? 1 : -1) } if a[-1] == 0 && a.all? { |i| i >= 0 } puts s.join end }
null
null
null
func main() var n: int :: cui@inputInt() if(n % 2 <> 0) do cui@print("\n") ret end if for i(0, 2 ^ n - 1) var id: int :: i var cntOpen: int :: 0 var cntClose: int :: 0 var a: []bool :: #[n]bool for j(0, n - 1) do a[j] :: id % 2 = 1 if(a[j]) do cntOpen :+ 1 if(cntOpen > n / 2) skip...
null
23
002
null
null
from itertools import product n = int(input()) ans = [] if n % 2 == 0: # 奇数のときは正しいカッコ列を生成できない for i in product([0, 1], repeat = n): # 0 -> ( , 1 -> ) if i.count(1) == n // 2: # 0, 1の個数が同じ時に判定を始める zero_count = 0 Bool = True word = "" for j in range(len(i)): ...
null
null
null
null
24
002
null
null
from itertools import product n = int(input()) ans = [] if n % 2 == 0: # 奇数のときは正しいカッコ列を生成できない for i in product([0, 1], repeat = n): # 0 -> ( , 1 -> ) if i.count(1) == n // 2: # 0, 1の個数が同じ時に判定を始める zero_count = 0 Bool = True word = "" for j in range(len(i)): ...
null
null
func main() var n: int :: cui@inputInt() if(n % 2 <> 0) do cui@print("\n") ret end if for i(0, 2 ^ n - 1) var id: int :: i var cntOpen: int :: 0 var cntClose: int :: 0 var a: []bool :: #[n]bool for j(0, n - 1) do a[j] :: id % 2 = 1 if(a[j]) do cntOpen :+ 1 if(cntOpen > n / 2) skip...
null
25
002
null
null
null
null
null
func main() var n: int :: cui@inputInt() if(n % 2 <> 0) do cui@print("\n") ret end if for i(0, 2 ^ n - 1) var id: int :: i var cntOpen: int :: 0 var cntClose: int :: 0 var a: []bool :: #[n]bool for j(0, n - 1) do a[j] :: id % 2 = 1 if(a[j]) do cntOpen :+ 1 if(cntOpen > n / 2) skip...
null
26
003
#include <iostream> #include <vector> #include <queue> using namespace std; // 入力 int N; int A[1 << 18], B[1 << 18]; // グラフ const int INF = (1 << 29); vector<int> G[1 << 18]; int dist[1 << 18]; void getdist(int start) { // 幅優先探索(BFS)により、最短距離を計算 for (int i = 1; i <= N; i++) dist[i] = INF; queue<...
class UnweightedGraph getter graph : Array(Array(Int32)) def initialize(size : Int) @graph = Array.new(size) { Array(Int32).new } end def add_edge(v, u) @graph[v] << u @graph[u] << v end delegate size, to: @graph delegate :[], to: @graph private def tree_depth_dfs(v : Int32, p : Int32, d...
null
null
null
null
null
27
003
#include <iostream> #include <vector> #include <queue> using namespace std; // 入力 int N; int A[1 << 18], B[1 << 18]; // グラフ const int INF = (1 << 29); vector<int> G[1 << 18]; int dist[1 << 18]; void getdist(int start) { // 幅優先探索(BFS)により、最短距離を計算 for (int i = 1; i <= N; i++) dist[i] = INF; queue<...
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys sys.setrecursionlimit(10**6) N = int(input()) G = [[] for _ in range(N)] for _ in range(N - 1): a, b = map(int, input().split()) a, b = a - 1, b - 1 G[a].append(b) G[b].append(a) def dfs(s): D = [-1] * N D[s] = 0 stk = [s] push, ...
null
null
null
null
28
003
#include <iostream> #include <vector> #include <queue> using namespace std; // 入力 int N; int A[1 << 18], B[1 << 18]; // グラフ const int INF = (1 << 29); vector<int> G[1 << 18]; int dist[1 << 18]; void getdist(int start) { // 幅優先探索(BFS)により、最短距離を計算 for (int i = 1; i <= N; i++) dist[i] = INF; queue<...
null
null
null
null
null
null
29
003
#include <iostream> #include <vector> #include <queue> using namespace std; // 入力 int N; int A[1 << 18], B[1 << 18]; // グラフ const int INF = (1 << 29); vector<int> G[1 << 18]; int dist[1 << 18]; void getdist(int start) { // 幅優先探索(BFS)により、最短距離を計算 for (int i = 1; i <= N; i++) dist[i] = INF; queue<...
null
null
null
use proconio::{input,marker::Usize1}; use std::collections::VecDeque; fn main(){ input!{n:usize} let mut g=vec![vec![];n]; for _ in 1..n{ input!{x:Usize1,y:Usize1} g[x].push(y); g[y].push(x); } let mut d=vec![1<<30;n]; bfs(&g,&mut d,0usize); let mut u:usize=0; le...
null
null
30
003
#include <iostream> #include <vector> #include <queue> using namespace std; // 入力 int N; int A[1 << 18], B[1 << 18]; // グラフ const int INF = (1 << 29); vector<int> G[1 << 18]; int dist[1 << 18]; void getdist(int start) { // 幅優先探索(BFS)により、最短距離を計算 for (int i = 1; i <= N; i++) dist[i] = INF; queue<...
null
null
null
null
func main() var n: int :: cui@inputInt() var graph: []list<int> :: #[n]list<int> for i(0, n - 1) do graph[i] :: #list<int> end for for i(0, n - 2) var a: int :: cui@inputInt() - 1 var b: int :: cui@inputInt() - 1 do graph[a].add(b) do graph[b].add(a) end for var ans: int :: treeDiameter(graph) + 1 d...
null
31
003
null
class UnweightedGraph getter graph : Array(Array(Int32)) def initialize(size : Int) @graph = Array.new(size) { Array(Int32).new } end def add_edge(v, u) @graph[v] << u @graph[u] << v end delegate size, to: @graph delegate :[], to: @graph private def tree_depth_dfs(v : Int32, p : Int32, d...
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys sys.setrecursionlimit(10**6) N = int(input()) G = [[] for _ in range(N)] for _ in range(N - 1): a, b = map(int, input().split()) a, b = a - 1, b - 1 G[a].append(b) G[b].append(a) def dfs(s): D = [-1] * N D[s] = 0 stk = [s] push, ...
null
null
null
null
32
003
null
class UnweightedGraph getter graph : Array(Array(Int32)) def initialize(size : Int) @graph = Array.new(size) { Array(Int32).new } end def add_edge(v, u) @graph[v] << u @graph[u] << v end delegate size, to: @graph delegate :[], to: @graph private def tree_depth_dfs(v : Int32, p : Int32, d...
null
null
null
null
null
33
003
null
class UnweightedGraph getter graph : Array(Array(Int32)) def initialize(size : Int) @graph = Array.new(size) { Array(Int32).new } end def add_edge(v, u) @graph[v] << u @graph[u] << v end delegate size, to: @graph delegate :[], to: @graph private def tree_depth_dfs(v : Int32, p : Int32, d...
null
null
use proconio::{input,marker::Usize1}; use std::collections::VecDeque; fn main(){ input!{n:usize} let mut g=vec![vec![];n]; for _ in 1..n{ input!{x:Usize1,y:Usize1} g[x].push(y); g[y].push(x); } let mut d=vec![1<<30;n]; bfs(&g,&mut d,0usize); let mut u:usize=0; le...
null
null
34
003
null
class UnweightedGraph getter graph : Array(Array(Int32)) def initialize(size : Int) @graph = Array.new(size) { Array(Int32).new } end def add_edge(v, u) @graph[v] << u @graph[u] << v end delegate size, to: @graph delegate :[], to: @graph private def tree_depth_dfs(v : Int32, p : Int32, d...
null
null
null
func main() var n: int :: cui@inputInt() var graph: []list<int> :: #[n]list<int> for i(0, n - 1) do graph[i] :: #list<int> end for for i(0, n - 2) var a: int :: cui@inputInt() - 1 var b: int :: cui@inputInt() - 1 do graph[a].add(b) do graph[b].add(a) end for var ans: int :: treeDiameter(graph) + 1 d...
null
35
003
null
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys sys.setrecursionlimit(10**6) N = int(input()) G = [[] for _ in range(N)] for _ in range(N - 1): a, b = map(int, input().split()) a, b = a - 1, b - 1 G[a].append(b) G[b].append(a) def dfs(s): D = [-1] * N D[s] = 0 stk = [s] push, ...
null
null
null
null
36
003
null
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys sys.setrecursionlimit(10**6) N = int(input()) G = [[] for _ in range(N)] for _ in range(N - 1): a, b = map(int, input().split()) a, b = a - 1, b - 1 G[a].append(b) G[b].append(a) def dfs(s): D = [-1] * N D[s] = 0 stk = [s] push, ...
null
use proconio::{input,marker::Usize1}; use std::collections::VecDeque; fn main(){ input!{n:usize} let mut g=vec![vec![];n]; for _ in 1..n{ input!{x:Usize1,y:Usize1} g[x].push(y); g[y].push(x); } let mut d=vec![1<<30;n]; bfs(&g,&mut d,0usize); let mut u:usize=0; le...
null
null
37
003
null
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys sys.setrecursionlimit(10**6) N = int(input()) G = [[] for _ in range(N)] for _ in range(N - 1): a, b = map(int, input().split()) a, b = a - 1, b - 1 G[a].append(b) G[b].append(a) def dfs(s): D = [-1] * N D[s] = 0 stk = [s] push, ...
null
null
func main() var n: int :: cui@inputInt() var graph: []list<int> :: #[n]list<int> for i(0, n - 1) do graph[i] :: #list<int> end for for i(0, n - 2) var a: int :: cui@inputInt() - 1 var b: int :: cui@inputInt() - 1 do graph[a].add(b) do graph[b].add(a) end for var ans: int :: treeDiameter(graph) + 1 d...
null
38
003
null
null
null
null
use proconio::{input,marker::Usize1}; use std::collections::VecDeque; fn main(){ input!{n:usize} let mut g=vec![vec![];n]; for _ in 1..n{ input!{x:Usize1,y:Usize1} g[x].push(y); g[y].push(x); } let mut d=vec![1<<30;n]; bfs(&g,&mut d,0usize); let mut u:usize=0; le...
null
null
39
003
null
null
null
null
null
func main() var n: int :: cui@inputInt() var graph: []list<int> :: #[n]list<int> for i(0, n - 1) do graph[i] :: #list<int> end for for i(0, n - 2) var a: int :: cui@inputInt() - 1 var b: int :: cui@inputInt() - 1 do graph[a].add(b) do graph[b].add(a) end for var ans: int :: treeDiameter(graph) + 1 d...
null
40
003
null
null
null
null
use proconio::{input,marker::Usize1}; use std::collections::VecDeque; fn main(){ input!{n:usize} let mut g=vec![vec![];n]; for _ in 1..n{ input!{x:Usize1,y:Usize1} g[x].push(y); g[y].push(x); } let mut d=vec![1<<30;n]; bfs(&g,&mut d,0usize); let mut u:usize=0; le...
func main() var n: int :: cui@inputInt() var graph: []list<int> :: #[n]list<int> for i(0, n - 1) do graph[i] :: #list<int> end for for i(0, n - 2) var a: int :: cui@inputInt() - 1 var b: int :: cui@inputInt() - 1 do graph[a].add(b) do graph[b].add(a) end for var ans: int :: treeDiameter(graph) + 1 d...
null
41
004
#include <iostream> using namespace std; #pragma warning (disable: 4996) int H, W; int A[2009][2009]; int Row[2009], Column[2009]; int Answer[2009][2009]; int main() { // Step #1. “ü—Í cin >> H >> W; for (int i = 1; i <= H; i++) { for (int j = 1; j <= W; j++) { scanf("%d", &A[i][j]); } } ...
h, w = read_line.split.map(&.to_i) a = (1..h).map { read_line.split.map(&.to_i) } row_sum = a.map(&.sum) column_sum = a.transpose.map(&.sum) (0...h).each do |i| puts (0...w).join(' ') { |j| row_sum[i] + column_sum[j] - a[i][j] } end
null
null
null
null
null
42
004
null
h, w = read_line.split.map(&.to_i) a = (1..h).map { read_line.split.map(&.to_i) } row_sum = a.map(&.sum) column_sum = a.transpose.map(&.sum) (0...h).each do |i| puts (0...w).join(' ') { |j| row_sum[i] + column_sum[j] - a[i][j] } end
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys def main(): input = sys.stdin.readline H, W = map(int, input().split()) A = [tuple(map(int, input().split())) for _ in range(H)] R = [sum(A[i]) for i in range(H)] C = [sum(A[i][j] for i in range(H)) for j in range(W)] ans = [[R[i] + C[j] ...
null
null
null
null
43
004
null
h, w = read_line.split.map(&.to_i) a = (1..h).map { read_line.split.map(&.to_i) } row_sum = a.map(&.sum) column_sum = a.transpose.map(&.sum) (0...h).each do |i| puts (0...w).join(' ') { |j| row_sum[i] + column_sum[j] - a[i][j] } end
null
null
null
null
null
44
004
null
h, w = read_line.split.map(&.to_i) a = (1..h).map { read_line.split.map(&.to_i) } row_sum = a.map(&.sum) column_sum = a.transpose.map(&.sum) (0...h).each do |i| puts (0...w).join(' ') { |j| row_sum[i] + column_sum[j] - a[i][j] } end
null
null
null
func main() var h: int :: cui@inputInt() var w: int :: cui@inputInt() do cui@delimiter("") var s: []char :: cui@inputStr() var idx: int :: 0 var a: [][]int :: #[h, w]int var row: []int :: #[h]int var col: []int :: #[w]int for y(0, h - 1) for x(0, w - 1) var v: int :: 0 while('0' <= s[idx]) do v :* ...
null
45
004
#include <iostream> using namespace std; #pragma warning (disable: 4996) int H, W; int A[2009][2009]; int Row[2009], Column[2009]; int Answer[2009][2009]; int main() { // Step #1. “ü—Í cin >> H >> W; for (int i = 1; i <= H; i++) { for (int j = 1; j <= W; j++) { scanf("%d", &A[i][j]); } } ...
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys def main(): input = sys.stdin.readline H, W = map(int, input().split()) A = [tuple(map(int, input().split())) for _ in range(H)] R = [sum(A[i]) for i in range(H)] C = [sum(A[i][j] for i in range(H)) for j in range(W)] ans = [[R[i] + C[j] ...
null
null
null
null
46
004
#include <iostream> using namespace std; #pragma warning (disable: 4996) int H, W; int A[2009][2009]; int Row[2009], Column[2009]; int Answer[2009][2009]; int main() { // Step #1. “ü—Í cin >> H >> W; for (int i = 1; i <= H; i++) { for (int j = 1; j <= W; j++) { scanf("%d", &A[i][j]); } } ...
null
null
null
null
null
null
47
004
#include <iostream> using namespace std; #pragma warning (disable: 4996) int H, W; int A[2009][2009]; int Row[2009], Column[2009]; int Answer[2009][2009]; int main() { // Step #1. “ü—Í cin >> H >> W; for (int i = 1; i <= H; i++) { for (int j = 1; j <= W; j++) { scanf("%d", &A[i][j]); } } ...
null
null
null
null
func main() var h: int :: cui@inputInt() var w: int :: cui@inputInt() do cui@delimiter("") var s: []char :: cui@inputStr() var idx: int :: 0 var a: [][]int :: #[h, w]int var row: []int :: #[h]int var col: []int :: #[w]int for y(0, h - 1) for x(0, w - 1) var v: int :: 0 while('0' <= s[idx]) do v :* ...
null
48
004
null
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys def main(): input = sys.stdin.readline H, W = map(int, input().split()) A = [tuple(map(int, input().split())) for _ in range(H)] R = [sum(A[i]) for i in range(H)] C = [sum(A[i][j] for i in range(H)) for j in range(W)] ans = [[R[i] + C[j] ...
null
null
null
null
49
004
null
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys def main(): input = sys.stdin.readline H, W = map(int, input().split()) A = [tuple(map(int, input().split())) for _ in range(H)] R = [sum(A[i]) for i in range(H)] C = [sum(A[i][j] for i in range(H)) for j in range(W)] ans = [[R[i] + C[j] ...
null
null
func main() var h: int :: cui@inputInt() var w: int :: cui@inputInt() do cui@delimiter("") var s: []char :: cui@inputStr() var idx: int :: 0 var a: [][]int :: #[h, w]int var row: []int :: #[h]int var col: []int :: #[w]int for y(0, h - 1) for x(0, w - 1) var v: int :: 0 while('0' <= s[idx]) do v :* ...
null
50
004
null
null
null
null
null
func main() var h: int :: cui@inputInt() var w: int :: cui@inputInt() do cui@delimiter("") var s: []char :: cui@inputStr() var idx: int :: 0 var a: [][]int :: #[h, w]int var row: []int :: #[h]int var col: []int :: #[w]int for y(0, h - 1) for x(0, w - 1) var v: int :: 0 while('0' <= s[idx]) do v :* ...
null
51
005
#include <iostream> using namespace std; long long modpow(long long a, long long b, long long m) { long long p = 1, q = a; for (int i = 0; i < 63; i++) { if ((b & (1LL << i)) != 0) { p *= q; p %= m; } q *= q; q %= m; } return p; } const long long mod = 1000000007; // 入力 long long...
struct Mint MOD = 1000000007i64 def self.zero new end def self.raw(value : Int64) result = new result.value = value result end @value : Int64 def initialize @value = 0i64 end def initialize(value) @value = value.to_i64 % MOD end def initialize(m : self) @value = m...
null
null
null
null
null
52
005
#include <iostream> using namespace std; long long modpow(long long a, long long b, long long m) { long long p = 1, q = a; for (int i = 0; i < 63; i++) { if ((b & (1LL << i)) != 0) { p *= q; p %= m; } q *= q; q %= m; } return p; } const long long mod = 1000000007; // 入力 long long...
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys MOD = 10**9 + 7 def main(): input = sys.stdin.readline N, B, K = map(int, input().split()) *C, = map(int, input().split()) def f(left, right, shift): res = [0] * B for lm in range(B): for rm in range(B): ...
null
null
null
null
53
005
#include <iostream> using namespace std; long long modpow(long long a, long long b, long long m) { long long p = 1, q = a; for (int i = 0; i < 63; i++) { if ((b & (1LL << i)) != 0) { p *= q; p %= m; } q *= q; q %= m; } return p; } const long long mod = 1000000007; // 入力 long long...
null
null
null
null
func main() const mod: int :: 1000000007 var n: int :: cui@inputInt() var b: int :: cui@inputInt() var k: int :: cui@inputInt() var dp: []int :: #[b]int for i(0, k - 1) var c: int :: cui@inputInt() do dp[c % b] :+ 1 end for var ans: []int :: #[b]int var pow10: int :: 10 % b do ans[0] :: 1 while(n > 0...
null
54
005
null
struct Mint MOD = 1000000007i64 def self.zero new end def self.raw(value : Int64) result = new result.value = value result end @value : Int64 def initialize @value = 0i64 end def initialize(value) @value = value.to_i64 % MOD end def initialize(m : self) @value = m...
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys MOD = 10**9 + 7 def main(): input = sys.stdin.readline N, B, K = map(int, input().split()) *C, = map(int, input().split()) def f(left, right, shift): res = [0] * B for lm in range(B): for rm in range(B): ...
null
null
null
null
55
005
null
struct Mint MOD = 1000000007i64 def self.zero new end def self.raw(value : Int64) result = new result.value = value result end @value : Int64 def initialize @value = 0i64 end def initialize(value) @value = value.to_i64 % MOD end def initialize(m : self) @value = m...
null
null
null
func main() const mod: int :: 1000000007 var n: int :: cui@inputInt() var b: int :: cui@inputInt() var k: int :: cui@inputInt() var dp: []int :: #[b]int for i(0, k - 1) var c: int :: cui@inputInt() do dp[c % b] :+ 1 end for var ans: []int :: #[b]int var pow10: int :: 10 % b do ans[0] :: 1 while(n > 0...
null
56
005
null
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys MOD = 10**9 + 7 def main(): input = sys.stdin.readline N, B, K = map(int, input().split()) *C, = map(int, input().split()) def f(left, right, shift): res = [0] * B for lm in range(B): for rm in range(B): ...
null
null
func main() const mod: int :: 1000000007 var n: int :: cui@inputInt() var b: int :: cui@inputInt() var k: int :: cui@inputInt() var dp: []int :: #[b]int for i(0, k - 1) var c: int :: cui@inputInt() do dp[c % b] :+ 1 end for var ans: []int :: #[b]int var pow10: int :: 10 % b do ans[0] :: 1 while(n > 0...
null
57
006
/* 競プロ典型90問 第6問 s https://atcoder.jp/contests/typical90/submissions/23191468 */ #include <iostream> #include <algorithm> #include <vector> #include <queue> using namespace std; typedef long long ll; typedef pair<char, int> P; int N, K; string s; int main() { cin >> N >> K; cin >> s; priority_queue<P, vector<P>...
n, k = read_line.split.map(&.to_i) s = read_line next_index = ('a'..'z').map { |c| prev_index = n (0...n).reverse_each.map { |i| if s[i] == c prev_index = i else prev_index end }.to_a.reverse } index = 0 puts (1..k).join { |size| ('a'..'z').find { |char| next_index[char - 'a'][index...
null
null
null
null
null
58
006
null
n, k = read_line.split.map(&.to_i) s = read_line next_index = ('a'..'z').map { |c| prev_index = n (0...n).reverse_each.map { |i| if s[i] == c prev_index = i else prev_index end }.to_a.reverse } index = 0 puts (1..k).join { |size| ('a'..'z').find { |char| next_index[char - 'a'][index...
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) def main(): N, K = map(int, input().split()) S = input() a = ord('a') st = SegmentTree( f=min, identity_factory=lambda: ( 27, len(S)), initial_values=[ (ord(s) - a, i) for i, s in enumerate(S)]) ans = [] l = 0 r =...
null
null
null
null
59
006
null
n, k = read_line.split.map(&.to_i) s = read_line next_index = ('a'..'z').map { |c| prev_index = n (0...n).reverse_each.map { |i| if s[i] == c prev_index = i else prev_index end }.to_a.reverse } index = 0 puts (1..k).join { |size| ('a'..'z').find { |char| next_index[char - 'a'][index...
null
null
null
func main() var n: int :: cui@inputInt() var k: int :: cui@inputInt() var s: []char :: cui@input() var nextPos: [][]int :: #[n, 26]int var pos: []int :: [n].repeat(26) for i(n - 1, 0, -1) do pos[s[i] $ int - 'a' $ int] :: i for j(0, 25) do nextPos[i][j] :: pos[j] end for end for var p: int :: 0 var an...
null
60
006
/* 競プロ典型90問 第6問 s https://atcoder.jp/contests/typical90/submissions/23191468 */ #include <iostream> #include <algorithm> #include <vector> #include <queue> using namespace std; typedef long long ll; typedef pair<char, int> P; int N, K; string s; int main() { cin >> N >> K; cin >> s; priority_queue<P, vector<P>...
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) def main(): N, K = map(int, input().split()) S = input() a = ord('a') st = SegmentTree( f=min, identity_factory=lambda: ( 27, len(S)), initial_values=[ (ord(s) - a, i) for i, s in enumerate(S)]) ans = [] l = 0 r =...
null
null
null
null
61
006
/* 競プロ典型90問 第6問 s https://atcoder.jp/contests/typical90/submissions/23191468 */ #include <iostream> #include <algorithm> #include <vector> #include <queue> using namespace std; typedef long long ll; typedef pair<char, int> P; int N, K; string s; int main() { cin >> N >> K; cin >> s; priority_queue<P, vector<P>...
null
null
null
null
func main() var n: int :: cui@inputInt() var k: int :: cui@inputInt() var s: []char :: cui@input() var nextPos: [][]int :: #[n, 26]int var pos: []int :: [n].repeat(26) for i(n - 1, 0, -1) do pos[s[i] $ int - 'a' $ int] :: i for j(0, 25) do nextPos[i][j] :: pos[j] end for end for var p: int :: 0 var an...
null
62
006
null
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) def main(): N, K = map(int, input().split()) S = input() a = ord('a') st = SegmentTree( f=min, identity_factory=lambda: ( 27, len(S)), initial_values=[ (ord(s) - a, i) for i, s in enumerate(S)]) ans = [] l = 0 r =...
null
null
func main() var n: int :: cui@inputInt() var k: int :: cui@inputInt() var s: []char :: cui@input() var nextPos: [][]int :: #[n, 26]int var pos: []int :: [n].repeat(26) for i(n - 1, 0, -1) do pos[s[i] $ int - 'a' $ int] :: i for j(0, 25) do nextPos[i][j] :: pos[j] end for end for var p: int :: 0 var an...
null
63
007
#include <iostream> #include <algorithm> #include <cmath> using namespace std; const int INF = 2000000000; int N; int A[300009]; int Q; int B[300009]; int main() { // Step #1. Input cin >> N; for (int i = 1; i <= N; i++) cin >> A[i]; cin >> Q; for (int i = 1; i <= Q; i++) cin >> B[i]; // Step...
read_line a = [-2*10**9] + read_line.split.map(&.to_i).sort + [2*10**9] read_line.to_i.times do b = read_line.to_i i = a.bsearch_index { |x| x > b }.not_nil! puts a[i - 1..i + 1].min_of { |x| (b - x).abs } end
null
null
null
null
null
64
007
#include <iostream> #include <algorithm> #include <cmath> using namespace std; const int INF = 2000000000; int N; int A[300009]; int Q; int B[300009]; int main() { // Step #1. Input cin >> N; for (int i = 1; i <= N; i++) cin >> A[i]; cin >> Q; for (int i = 1; i <= Q; i++) cin >> B[i]; // Step...
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) from bisect import bisect_left N = int(input()) *A, = map(int, input().split()) Q = int(input()) A.sort() for _ in range(Q): b = int(input()) i = bisect_left(A, b) u = 10**18 if i < N: u = min(u, abs(A[i] - b)) if i > 0: u = min(u, abs(A...
null
null
null
null
65
007
#include <iostream> #include <algorithm> #include <cmath> using namespace std; const int INF = 2000000000; int N; int A[300009]; int Q; int B[300009]; int main() { // Step #1. Input cin >> N; for (int i = 1; i <= N; i++) cin >> A[i]; cin >> Q; for (int i = 1; i <= Q; i++) cin >> B[i]; // Step...
null
null
null
null
func main() var n: int :: cui@inputInt() var a: []int :: #[n]int for i(0, n - 1) do a[i] :: cui@inputInt() end for do a.sort() var q: int :: cui@inputInt() for(1, q) var b: int :: cui@inputInt() var ok: int :: 0 var ng: int :: n while((ok - ng).abs() > 1) var mid: int :: (ok + ng) / 2 if(a[mi...
null
66
007
null
read_line a = [-2*10**9] + read_line.split.map(&.to_i).sort + [2*10**9] read_line.to_i.times do b = read_line.to_i i = a.bsearch_index { |x| x > b }.not_nil! puts a[i - 1..i + 1].min_of { |x| (b - x).abs } end
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) from bisect import bisect_left N = int(input()) *A, = map(int, input().split()) Q = int(input()) A.sort() for _ in range(Q): b = int(input()) i = bisect_left(A, b) u = 10**18 if i < N: u = min(u, abs(A[i] - b)) if i > 0: u = min(u, abs(A...
null
null
null
null
67
007
null
read_line a = [-2*10**9] + read_line.split.map(&.to_i).sort + [2*10**9] read_line.to_i.times do b = read_line.to_i i = a.bsearch_index { |x| x > b }.not_nil! puts a[i - 1..i + 1].min_of { |x| (b - x).abs } end
null
null
null
func main() var n: int :: cui@inputInt() var a: []int :: #[n]int for i(0, n - 1) do a[i] :: cui@inputInt() end for do a.sort() var q: int :: cui@inputInt() for(1, q) var b: int :: cui@inputInt() var ok: int :: 0 var ng: int :: n while((ok - ng).abs() > 1) var mid: int :: (ok + ng) / 2 if(a[mi...
null
68
007
null
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) from bisect import bisect_left N = int(input()) *A, = map(int, input().split()) Q = int(input()) A.sort() for _ in range(Q): b = int(input()) i = bisect_left(A, b) u = 10**18 if i < N: u = min(u, abs(A[i] - b)) if i > 0: u = min(u, abs(A...
null
null
func main() var n: int :: cui@inputInt() var a: []int :: #[n]int for i(0, n - 1) do a[i] :: cui@inputInt() end for do a.sort() var q: int :: cui@inputInt() for(1, q) var b: int :: cui@inputInt() var ok: int :: 0 var ng: int :: n while((ok - ng).abs() > 1) var mid: int :: (ok + ng) / 2 if(a[mi...
null
69
008
#include <iostream> #include <string> #include <vector> #define mod 1000000007 using namespace std; //19[ms] string t = "atcoder"; int main(){ int n; string s; cin >> n >> s; vector<vector<int>> dp(8, vector<int>(n + 1)); for(int i = 0; i <= n; i++) dp[0][i] = 1; for(int i = 0; i < 7; i++){ for(int j =...
read_line s = read_line atcoder = "?atcoder" m = atcoder.size puts s.chars.each_with_object([1] + [0] * m.pred) { |c, dp| if i = atcoder.index(c) dp[i] = (dp[i] + dp[i - 1]) % (10**9 + 7) end }.last
null
null
null
null
null
70
008
#include <iostream> #include <string> #include <vector> #define mod 1000000007 using namespace std; //19[ms] string t = "atcoder"; int main(){ int n; string s; cin >> n >> s; vector<vector<int>> dp(8, vector<int>(n + 1)); for(int i = 0; i <= n; i++) dp[0][i] = 1; for(int i = 0; i < 7; i++){ for(int j =...
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) from collections import defaultdict MOD = 10**9 + 7 N = int(input()) S = input() C = defaultdict(int) ATCODER = 'atcoder' dp = [0] * len(ATCODER) for s in S[::-1]: if s in ATCODER: i = ATCODER.index(s) if i == len(ATCODER) - 1: dp[i] += 1 ...
null
null
null
null
71
008
#include <iostream> #include <string> #include <vector> #define mod 1000000007 using namespace std; //19[ms] string t = "atcoder"; int main(){ int n; string s; cin >> n >> s; vector<vector<int>> dp(8, vector<int>(n + 1)); for(int i = 0; i <= n; i++) dp[0][i] = 1; for(int i = 0; i < 7; i++){ for(int j =...
null
null
null
null
func main() var n: int :: cui@inputInt() var s: []char :: cui@input() var atcoder: []char :: "atcoder" var dp: []int :: #[^atcoder + 1]int do dp[0] :: 1 for i(0, n - 1) for j(0, ^atcoder - 1) if(s[i] = atcoder[j]) do dp[j + 1] :+ dp[j] do dp[j + 1] :% 10 ^ 9 + 7 end if end for end for var ...
null
72
008
null
read_line s = read_line atcoder = "?atcoder" m = atcoder.size puts s.chars.each_with_object([1] + [0] * m.pred) { |c, dp| if i = atcoder.index(c) dp[i] = (dp[i] + dp[i - 1]) % (10**9 + 7) end }.last
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) from collections import defaultdict MOD = 10**9 + 7 N = int(input()) S = input() C = defaultdict(int) ATCODER = 'atcoder' dp = [0] * len(ATCODER) for s in S[::-1]: if s in ATCODER: i = ATCODER.index(s) if i == len(ATCODER) - 1: dp[i] += 1 ...
null
null
null
null
73
008
null
read_line s = read_line atcoder = "?atcoder" m = atcoder.size puts s.chars.each_with_object([1] + [0] * m.pred) { |c, dp| if i = atcoder.index(c) dp[i] = (dp[i] + dp[i - 1]) % (10**9 + 7) end }.last
null
null
null
func main() var n: int :: cui@inputInt() var s: []char :: cui@input() var atcoder: []char :: "atcoder" var dp: []int :: #[^atcoder + 1]int do dp[0] :: 1 for i(0, n - 1) for j(0, ^atcoder - 1) if(s[i] = atcoder[j]) do dp[j + 1] :+ dp[j] do dp[j + 1] :% 10 ^ 9 + 7 end if end for end for var ...
null
74
008
null
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) from collections import defaultdict MOD = 10**9 + 7 N = int(input()) S = input() C = defaultdict(int) ATCODER = 'atcoder' dp = [0] * len(ATCODER) for s in S[::-1]: if s in ATCODER: i = ATCODER.index(s) if i == len(ATCODER) - 1: dp[i] += 1 ...
null
null
func main() var n: int :: cui@inputInt() var s: []char :: cui@input() var atcoder: []char :: "atcoder" var dp: []int :: #[^atcoder + 1]int do dp[0] :: 1 for i(0, n - 1) for j(0, ^atcoder - 1) if(s[i] = atcoder[j]) do dp[j + 1] :+ dp[j] do dp[j + 1] :% 10 ^ 9 + 7 end if end for end for var ...
null
75
009
#include <iostream> #include <cmath> #include <vector> #include <algorithm> using namespace std; struct Point { double px, py; }; Point operator-(const Point& a1, const Point& a2) { return Point{ a1.px - a2.px, a1.py - a2.py }; } double getangle(Point G) { // 点 G の偏角を求める if (G.py >= 0.0) { dou...
# 0.36.0 以降は Math::TAU があります TAU = Math::PI * 2 n = read_line.to_i xy = (1..n).map { {Int32, Int32}.from read_line.split.map(&.to_i) } puts (0...n).max_of { |i| angle = (0...n).select { |j| i != j }.map { |j| Math.atan2(xy[j][1] - xy[i][1], xy[j][0] - xy[i][0]) } angles = angle.flat_map { |a| [a, a + Math::...
null
null
null
null
null
76
009
#include <iostream> #include <cmath> #include <vector> #include <algorithm> using namespace std; struct Point { double px, py; }; Point operator-(const Point& a1, const Point& a2) { return Point{ a1.px - a2.px, a1.py - a2.py }; } double getangle(Point G) { // 点 G の偏角を求める if (G.py >= 0.0) { dou...
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) from bisect import bisect_left from cmath import phase, pi from typing import List C = 2 * pi N = int(input()) P: List[complex] = [] for _ in range(N): x, y = map(int, input().split()) P.append(x + y * 1j) ans = 0 for i in range(N): A = sorted((phase(P[j] - P[i...
null
null
null
null
77
009
#include <iostream> #include <cmath> #include <vector> #include <algorithm> using namespace std; struct Point { double px, py; }; Point operator-(const Point& a1, const Point& a2) { return Point{ a1.px - a2.px, a1.py - a2.py }; } double getangle(Point G) { // 点 G の偏角を求める if (G.py >= 0.0) { dou...
null
null
null
null
null
null
78
009
#include <iostream> #include <cmath> #include <vector> #include <algorithm> using namespace std; struct Point { double px, py; }; Point operator-(const Point& a1, const Point& a2) { return Point{ a1.px - a2.px, a1.py - a2.py }; } double getangle(Point G) { // 点 G の偏角を求める if (G.py >= 0.0) { dou...
null
null
null
null
func main() var n: int :: cui@inputInt() var x: []float :: #[n]float var y: []float :: #[n]float for i(0, n - 1) do x[i] :: cui@inputFloat() do y[i] :: cui@inputFloat() end for var ans: float :: 0.0 for i(0, n - 1) var rots: []float :: #[n]float for j(0, n - 1) if(i = j) if(i = 0) do rots[j...
null
79
009
null
# 0.36.0 以降は Math::TAU があります TAU = Math::PI * 2 n = read_line.to_i xy = (1..n).map { {Int32, Int32}.from read_line.split.map(&.to_i) } puts (0...n).max_of { |i| angle = (0...n).select { |j| i != j }.map { |j| Math.atan2(xy[j][1] - xy[i][1], xy[j][0] - xy[i][0]) } angles = angle.flat_map { |a| [a, a + Math::...
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) from bisect import bisect_left from cmath import phase, pi from typing import List C = 2 * pi N = int(input()) P: List[complex] = [] for _ in range(N): x, y = map(int, input().split()) P.append(x + y * 1j) ans = 0 for i in range(N): A = sorted((phase(P[j] - P[i...
null
null
null
null
80
009
null
# 0.36.0 以降は Math::TAU があります TAU = Math::PI * 2 n = read_line.to_i xy = (1..n).map { {Int32, Int32}.from read_line.split.map(&.to_i) } puts (0...n).max_of { |i| angle = (0...n).select { |j| i != j }.map { |j| Math.atan2(xy[j][1] - xy[i][1], xy[j][0] - xy[i][0]) } angles = angle.flat_map { |a| [a, a + Math::...
null
null
null
null
null
81
009
null
# 0.36.0 以降は Math::TAU があります TAU = Math::PI * 2 n = read_line.to_i xy = (1..n).map { {Int32, Int32}.from read_line.split.map(&.to_i) } puts (0...n).max_of { |i| angle = (0...n).select { |j| i != j }.map { |j| Math.atan2(xy[j][1] - xy[i][1], xy[j][0] - xy[i][0]) } angles = angle.flat_map { |a| [a, a + Math::...
null
null
null
func main() var n: int :: cui@inputInt() var x: []float :: #[n]float var y: []float :: #[n]float for i(0, n - 1) do x[i] :: cui@inputFloat() do y[i] :: cui@inputFloat() end for var ans: float :: 0.0 for i(0, n - 1) var rots: []float :: #[n]float for j(0, n - 1) if(i = j) if(i = 0) do rots[j...
null
82
009
null
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) from bisect import bisect_left from cmath import phase, pi from typing import List C = 2 * pi N = int(input()) P: List[complex] = [] for _ in range(N): x, y = map(int, input().split()) P.append(x + y * 1j) ans = 0 for i in range(N): A = sorted((phase(P[j] - P[i...
null
null
null
null
83
009
null
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) from bisect import bisect_left from cmath import phase, pi from typing import List C = 2 * pi N = int(input()) P: List[complex] = [] for _ in range(N): x, y = map(int, input().split()) P.append(x + y * 1j) ans = 0 for i in range(N): A = sorted((phase(P[j] - P[i...
null
null
func main() var n: int :: cui@inputInt() var x: []float :: #[n]float var y: []float :: #[n]float for i(0, n - 1) do x[i] :: cui@inputFloat() do y[i] :: cui@inputFloat() end for var ans: float :: 0.0 for i(0, n - 1) var rots: []float :: #[n]float for j(0, n - 1) if(i = j) if(i = 0) do rots[j...
null
84
009
null
null
null
null
null
func main() var n: int :: cui@inputInt() var x: []float :: #[n]float var y: []float :: #[n]float for i(0, n - 1) do x[i] :: cui@inputFloat() do y[i] :: cui@inputFloat() end for var ans: float :: 0.0 for i(0, n - 1) var rots: []float :: #[n]float for j(0, n - 1) if(i = j) if(i = 0) do rots[j...
null
85
010
#include <iostream> using namespace std; // 入力 int N; int C[100009], P[100009]; int Q; int L[100009], R[100009]; // 累積和 int Sum1[100009]; int Sum2[100009]; int main() { // Step #1. 入力 cin >> N; for (int i = 1; i <= N; i++) cin >> C[i] >> P[i]; cin >> Q; for (int i = 1; i <= Q; i++) cin >> L[i]...
n = read_line.to_i sums = {0, 1}.map { [0] * n.succ } n.times do |i| c, p = read_line.split.map(&.to_i) sums.each { |sum| sum[i + 1] += sum[i] } sums[c - 1][i + 1] += p end read_line.to_i.times do l, r = read_line.split.map(&.to_i) puts sums.join(' ') { |sum| sum[r] - sum[l - 1] } end
null
null
null
null
null
86
010
#include <iostream> using namespace std; // 入力 int N; int C[100009], P[100009]; int Q; int L[100009], R[100009]; // 累積和 int Sum1[100009]; int Sum2[100009]; int main() { // Step #1. 入力 cin >> N; for (int i = 1; i <= N; i++) cin >> C[i] >> P[i]; cin >> Q; for (int i = 1; i <= Q; i++) cin >> L[i]...
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) N = int(input()) S = [[0] * (N + 1) for _ in range(2)] for i in range(N): c, p = map(int, input().split()) S[c - 1][i + 1] = p for i in range(N): for j in range(2): S[j][i + 1] += S[j][i] Q = int(input()) LR = [tuple(map(int, input().split())) for _ in ...
null
null
null
null
87
010
#include <iostream> using namespace std; // 入力 int N; int C[100009], P[100009]; int Q; int L[100009], R[100009]; // 累積和 int Sum1[100009]; int Sum2[100009]; int main() { // Step #1. 入力 cin >> N; for (int i = 1; i <= N; i++) cin >> C[i] >> P[i]; cin >> Q; for (int i = 1; i <= Q; i++) cin >> L[i]...
null
null
null
null
func main() var n: int :: cui@inputInt() var cum1: []int :: #[n + 1]int var cum2: []int :: #[n + 1]int for i(0, n - 1) var c: int :: cui@inputInt() var p: int :: cui@inputInt() do cum1[i + 1] :: cum1[i] do cum2[i + 1] :: cum2[i] if(c = 1) do cum1[i + 1] :+ p else do cum2[i + 1] :+ p end if en...
null
88
010
null
n = read_line.to_i sums = {0, 1}.map { [0] * n.succ } n.times do |i| c, p = read_line.split.map(&.to_i) sums.each { |sum| sum[i + 1] += sum[i] } sums[c - 1][i + 1] += p end read_line.to_i.times do l, r = read_line.split.map(&.to_i) puts sums.join(' ') { |sum| sum[r] - sum[l - 1] } end
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) N = int(input()) S = [[0] * (N + 1) for _ in range(2)] for i in range(N): c, p = map(int, input().split()) S[c - 1][i + 1] = p for i in range(N): for j in range(2): S[j][i + 1] += S[j][i] Q = int(input()) LR = [tuple(map(int, input().split())) for _ in ...
null
null
null
null
89
010
null
n = read_line.to_i sums = {0, 1}.map { [0] * n.succ } n.times do |i| c, p = read_line.split.map(&.to_i) sums.each { |sum| sum[i + 1] += sum[i] } sums[c - 1][i + 1] += p end read_line.to_i.times do l, r = read_line.split.map(&.to_i) puts sums.join(' ') { |sum| sum[r] - sum[l - 1] } end
null
null
null
func main() var n: int :: cui@inputInt() var cum1: []int :: #[n + 1]int var cum2: []int :: #[n + 1]int for i(0, n - 1) var c: int :: cui@inputInt() var p: int :: cui@inputInt() do cum1[i + 1] :: cum1[i] do cum2[i + 1] :: cum2[i] if(c = 1) do cum1[i + 1] :+ p else do cum2[i + 1] :+ p end if en...
null
90
010
null
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) N = int(input()) S = [[0] * (N + 1) for _ in range(2)] for i in range(N): c, p = map(int, input().split()) S[c - 1][i + 1] = p for i in range(N): for j in range(2): S[j][i + 1] += S[j][i] Q = int(input()) LR = [tuple(map(int, input().split())) for _ in ...
null
null
func main() var n: int :: cui@inputInt() var cum1: []int :: #[n + 1]int var cum2: []int :: #[n + 1]int for i(0, n - 1) var c: int :: cui@inputInt() var p: int :: cui@inputInt() do cum1[i + 1] :: cum1[i] do cum2[i + 1] :: cum2[i] if(c = 1) do cum1[i + 1] :+ p else do cum2[i + 1] :+ p end if en...
null
91
011
#include <iostream> #include <vector> #include <algorithm> #include <tuple> using ll = long long; using namespace std; template<class T, class U> T &chmax(T &a, const U &b){ if(a < b) a = b; return a; } //43[ms] int main(){ int n; cin >> n; vector<tuple<int,int,int>> v(n); for(int i = 0; i < n; i++){ int d...
n = read_line.to_i dcs = (1..n).map { read_line.split.try { |(d, c, s)| {d.to_i, c.to_i, s.to_i64} } }.sort day = dcs.max_of { |(d, c, s)| d } puts dcs.each_with_object([0i64] * day.succ) { |(d, c, s), dp| (c..d).reverse_each do |i| dp[i] = {dp[i], dp[i - c] + s}.max end (0...day).each do |i| dp[i + 1]...
null
null
null
null
null
92
011
#include <iostream> #include <vector> #include <algorithm> #include <tuple> using ll = long long; using namespace std; template<class T, class U> T &chmax(T &a, const U &b){ if(a < b) a = b; return a; } //43[ms] int main(){ int n; cin >> n; vector<tuple<int,int,int>> v(n); for(int i = 0; i < n; i++){ int d...
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys def main(): input = sys.stdin.readline N = int(input()) DCS = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[0]) M = max(d for d, c, s in DCS) dp = [[0] * (M + 1) for _ in range(N + 1)] for i in range(N): ...
null
null
null
null
93
011
#include <iostream> #include <vector> #include <algorithm> #include <tuple> using ll = long long; using namespace std; template<class T, class U> T &chmax(T &a, const U &b){ if(a < b) a = b; return a; } //43[ms] int main(){ int n; cin >> n; vector<tuple<int,int,int>> v(n); for(int i = 0; i < n; i++){ int d...
null
null
null
null
null
null
94
011
#include <iostream> #include <vector> #include <algorithm> #include <tuple> using ll = long long; using namespace std; template<class T, class U> T &chmax(T &a, const U &b){ if(a < b) a = b; return a; } //43[ms] int main(){ int n; cin >> n; vector<tuple<int,int,int>> v(n); for(int i = 0; i < n; i++){ int d...
null
null
null
null
func main() var n: int :: cui@inputInt() var works: []Work :: #[n]Work var dMax: int :: 0 for i(0, n - 1) var d: int :: cui@inputInt() var c: int :: cui@inputInt() var s: int :: cui@inputInt() do works[i] :: (#Work).init(d, c, s) do dMax :: [dMax, d].max() end for do works.sort() ; dp[仕事番号][合計仕事時間] =...
null
95
011
null
n = read_line.to_i dcs = (1..n).map { read_line.split.try { |(d, c, s)| {d.to_i, c.to_i, s.to_i64} } }.sort day = dcs.max_of { |(d, c, s)| d } puts dcs.each_with_object([0i64] * day.succ) { |(d, c, s), dp| (c..d).reverse_each do |i| dp[i] = {dp[i], dp[i - c] + s}.max end (0...day).each do |i| dp[i + 1]...
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys def main(): input = sys.stdin.readline N = int(input()) DCS = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[0]) M = max(d for d, c, s in DCS) dp = [[0] * (M + 1) for _ in range(N + 1)] for i in range(N): ...
null
null
null
null
96
011
null
n = read_line.to_i dcs = (1..n).map { read_line.split.try { |(d, c, s)| {d.to_i, c.to_i, s.to_i64} } }.sort day = dcs.max_of { |(d, c, s)| d } puts dcs.each_with_object([0i64] * day.succ) { |(d, c, s), dp| (c..d).reverse_each do |i| dp[i] = {dp[i], dp[i - c] + s}.max end (0...day).each do |i| dp[i + 1]...
null
null
null
null
null
97
011
null
n = read_line.to_i dcs = (1..n).map { read_line.split.try { |(d, c, s)| {d.to_i, c.to_i, s.to_i64} } }.sort day = dcs.max_of { |(d, c, s)| d } puts dcs.each_with_object([0i64] * day.succ) { |(d, c, s), dp| (c..d).reverse_each do |i| dp[i] = {dp[i], dp[i - c] + s}.max end (0...day).each do |i| dp[i + 1]...
null
null
null
func main() var n: int :: cui@inputInt() var works: []Work :: #[n]Work var dMax: int :: 0 for i(0, n - 1) var d: int :: cui@inputInt() var c: int :: cui@inputInt() var s: int :: cui@inputInt() do works[i] :: (#Work).init(d, c, s) do dMax :: [dMax, d].max() end for do works.sort() ; dp[仕事番号][合計仕事時間] =...
null
98
011
null
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys def main(): input = sys.stdin.readline N = int(input()) DCS = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[0]) M = max(d for d, c, s in DCS) dp = [[0] * (M + 1) for _ in range(N + 1)] for i in range(N): ...
null
null
null
null
99
011
null
null
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys def main(): input = sys.stdin.readline N = int(input()) DCS = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[0]) M = max(d for d, c, s in DCS) dp = [[0] * (M + 1) for _ in range(N + 1)] for i in range(N): ...
null
null
func main() var n: int :: cui@inputInt() var works: []Work :: #[n]Work var dMax: int :: 0 for i(0, n - 1) var d: int :: cui@inputInt() var c: int :: cui@inputInt() var s: int :: cui@inputInt() do works[i] :: (#Work).init(d, c, s) do dMax :: [dMax, d].max() end for do works.sort() ; dp[仕事番号][合計仕事時間] =...
null
100
011
null
null
null
null
null
func main() var n: int :: cui@inputInt() var works: []Work :: #[n]Work var dMax: int :: 0 for i(0, n - 1) var d: int :: cui@inputInt() var c: int :: cui@inputInt() var s: int :: cui@inputInt() do works[i] :: (#Work).init(d, c, s) do dMax :: [dMax, d].max() end for do works.sort() ; dp[仕事番号][合計仕事時間] =...
null
End of preview.
README.md exists but content is empty.
Downloads last month
5