Skip to content

Commit c2eaa6a

Browse files
author
rdrgn
committed
Merge branch 'master' into remin/pair-programming
2 parents f9cb63c + 33c455d commit c2eaa6a

File tree

26 files changed

+609
-21
lines changed

26 files changed

+609
-21
lines changed

even2primes/java-tossy-tle/Even2PrimesNaive.java

100755100644
File mode changed.

even2primes/java-tossy-tle/SOLUTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#cxx_solution(src='main.cc', flags=[]) # -std=c++11 -O2 as default
66
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main')
77
java_solution(src='Even2PrimesNaive.java', encoding='UTF-8', mainclass='Even2PrimesNaive',
8-
challenge_cases=['large.in'])
8+
challenge_cases=[])
99
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main',
1010
# challenge_cases=['10_corner*.in'])
1111
#script_solution(src='main.sh') # shebang line is required
@@ -17,4 +17,4 @@ java_solution(src='Even2PrimesNaive.java', encoding='UTF-8', mainclass='Even2Pri
1717
#cs_solution(src='main.cs') # C# (mono)
1818

1919
## Score
20-
#expected_score(100)
20+
expected_score(10)

even2primes/python-tle/SOLUTION

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8; mode: python -*-
2+
3+
## Solution
4+
#c_solution(src='main.c') # -lm -O2 as default
5+
#cxx_solution(src='main.cc', flags=[]) # -std=c++11 -O2 as default
6+
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main')
7+
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main',
8+
# challenge_cases=[])
9+
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main',
10+
# challenge_cases=['10_corner*.in'])
11+
#script_solution(src='main.sh') # shebang line is required
12+
#script_solution(src='main.pl') # shebang line is required
13+
script_solution(src='main.py', challenge_cases=[]) # shebang line is required
14+
#script_solution(src='main.rb') # shebang line is required
15+
#js_solution(src='main.js') # javascript (nodejs)
16+
#hs_solution(src='main.hs') # haskell (stack + ghc)
17+
#cs_solution(src='main.cs') # C# (mono)
18+
19+
## Score
20+
expected_score(10)

even2primes/python-tle/main.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/local/bin/python3
2+
3+
import math
4+
import numpy
5+
6+
_ = int(input())
7+
8+
def all_primes(start, end):
9+
return list(sorted(set(range(start, end + 1)).difference(set((p * f) for p in range(2, int(end ** 0.5) + 2) for f in range(2, (end // p) + 1)))))
10+
11+
def primesfrom2to(n):
12+
""" Input n>=6, Returns a array of primes, 2 <= p < n """
13+
sieve = numpy.ones(n//3 + (n%6 == 2), dtype=numpy.bool)
14+
for i in range(1, int(n**0.5)//3+1):
15+
if sieve[i]:
16+
k=3*i+1|1
17+
sieve[k*k//3::2*k] = False
18+
sieve[k*(k-2*(i&1)+4)//3::2*k] = False
19+
return numpy.r_[2,3,((3*numpy.nonzero(sieve)[0][1:]+1)|1)]
20+
21+
for i in range(_):
22+
x = int(input())
23+
if x < 6:
24+
l = all_primes(2, x)
25+
else:
26+
l = primesfrom2to(x)
27+
ans = 0
28+
for i, p in enumerate(l):
29+
if 2*p > x:
30+
break
31+
if x - p in l:
32+
ans += 1
33+
print(ans)
34+

even2primes/tests/TESTSET

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ cxx_validator(src='validator.cpp', dependency=['testlib.h'])
1717
#cxx_judge(src='judge.cc')
1818
#java_judge(src='Judge.java', encoding='UTF-8', mainclass='Judge')
1919
#script_judge(src='judge.py')
20+
21+
subtask_testset(name='All', score=100, input_patterns=['*'])
22+
subtask_testset(name='Med', score=10, input_patterns=['sample.in', 'small.in', 'medium.in'])

pairprogramming/cpp-wrong/SOLUTION

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8; mode: python -*-
2+
3+
## Solution
4+
#c_solution(src='main.c') # -lm -O2 as default
5+
cxx_solution(src='main.cpp', flags=[], challenge_cases=['large.in']) # -std=c++11 -O2 as default
6+
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main')
7+
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main',
8+
# challenge_cases=[])
9+
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main',
10+
# challenge_cases=['10_corner*.in'])
11+
#script_solution(src='main.sh') # shebang line is required
12+
#script_solution(src='main.pl') # shebang line is required
13+
#script_solution(src='main.py') # shebang line is required
14+
#script_solution(src='main.rb') # shebang line is required
15+
#js_solution(src='main.js') # javascript (nodejs)
16+
#hs_solution(src='main.hs') # haskell (stack + ghc)
17+
#cs_solution(src='main.cs') # C# (mono)
18+
19+
## Score
20+
#expected_score(100)

pairprogramming/cpp-wrong/main.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main() {
5+
int t;
6+
cin >> t;
7+
int m = 0;
8+
for (int i = 0; i < t; i++) {
9+
int n;
10+
cin >> n;
11+
for (int j = 0; j < n; j++) {
12+
int a;
13+
cin >> a;
14+
m = (m + a) % 2;
15+
cout << m << endl;
16+
}
17+
}
18+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8; mode: python -*-
2+
3+
## Solution
4+
#c_solution(src='main.c') # -lm -O2 as default
5+
#cxx_solution(src='main.cc', flags=[]) # -std=c++11 -O2 as default
6+
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main')
7+
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main',
8+
# challenge_cases=[])
9+
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main',
10+
# challenge_cases=['10_corner*.in'])
11+
#script_solution(src='main.sh') # shebang line is required
12+
#script_solution(src='main.pl') # shebang line is required
13+
#script_solution(src='main.py') # shebang line is required
14+
script_solution(src='main.rb') # shebang line is required
15+
#js_solution(src='main.js') # javascript (nodejs)
16+
#hs_solution(src='main.hs') # haskell (stack + ghc)
17+
#cs_solution(src='main.cs') # C# (mono)
18+
19+
## Score
20+
#expected_score(100)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/ruby
2+
3+
l = gets.chomp.to_i
4+
i = []
5+
6+
l.times do
7+
n = gets.chomp.to_i
8+
str = gets.chomp.split(' ').map(&:to_i)
9+
10+
i << str
11+
end
12+
13+
i.each do |ary|
14+
result = []
15+
ary.each_with_index do |value, index|
16+
if index == 0
17+
result << value
18+
else
19+
result << value + result[index-1]
20+
end
21+
end
22+
result.each do |data|
23+
puts data % 2 == 0 ? 0 : 1
24+
end
25+
end
26+

shimashima/statement.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
しまりんの体は以下の図のように、1列に並んだ$A+B$個のブロックで表されます。
55
はじめ全てのブロックの色は茶色です。
66
1缶の絵の具で、ちょうど1個のブロックを塗ることができます。
7-
しまりんをシマウマにするには、$A+B$個のブロック全てを隣同士が異なる色になるように塗らなければいけません
7+
しまりんをシマウマにするには、$A+B$個のブロック全てを**白と黒が交互になる**ように塗らなければいけません
88
しまりんをシマウマにできるなら`YES`、できないなら`NO`を出力してください。
99

1010
# Constraints

0 commit comments

Comments
 (0)