Skip to content

Commit f986dad

Browse files
author
DAyamaCTF
authored
Merge pull request #25 from tossy310/dayama/shimashima
ShimaShima
2 parents 722fcf7 + 2a75943 commit f986dad

File tree

9 files changed

+163
-0
lines changed

9 files changed

+163
-0
lines changed

shimashima/PROBLEM

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# -*- coding: utf-8; mode: python -*-
2+
3+
pid='X'
4+
5+
problem(
6+
time_limit=1.0,
7+
id=pid,
8+
title=pid + "ShimaShima",
9+
#wiki_name="Your pukiwiki page name", # for wikify plugin
10+
#assignees=['Assignees', 'for', 'this', 'problem'], # for wikify plugin
11+
#need_custom_judge=True, # for wikify plugin
12+
reference_solution='c-correct',
13+
)
14+
15+
atcoder_config(
16+
task_id=None # None means a spare
17+
)

shimashima/c-correct/SOLUTION

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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', challenge_cases=[])
8+
#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main', challenge_cases=['10_corner*.in'])
9+
#script_solution(src='main.sh') # shebang line is required
10+
#script_solution(src='main.pl') # shebang line is required
11+
#script_solution(src='main.py') # shebang line is required
12+
#script_solution(src='main.rb') # shebang line is required
13+
#js_solution(src='main.js') # javascript (nodejs)
14+
#hs_solution(src='main.hs') # haskell (stack + ghc)
15+
#cs_solution(src='main.cs') # C# (mono)
16+
17+
## Score
18+
#expected_score(100)

shimashima/c-correct/main.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
4+
int main(){
5+
int T;
6+
scanf("%d", &T);
7+
for(int i = 0; i < T; i++){
8+
int A, B;
9+
scanf("%d %d", &A, &B);
10+
if(abs(A - B) <= 1){
11+
printf("YES\n");
12+
}else{
13+
printf("NO\n");
14+
}
15+
}
16+
return 0;
17+
}

shimashima/statement.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Description
2+
カトーくんは、ただの馬であるしまりんをシマウマにするため絵の具で色を塗ることにしました。
3+
今、黒い絵の具が$A$個、白い絵の具が$B$個あります。
4+
しまりんの体は以下の図のように、1列に並んだ$A+B$個のブロックで表され、1個の絵の具でちょうどしまりんを1ブロック塗ることができます。
5+
しまりんをシマウマにするには、$A+B$個のブロック全てを隣同士が異なる色になるように塗らなければいけません。
6+
しまりんをシマウマにできるなら`YES`、できないなら`NO`を出力してください。
7+
8+
# Constraints
9+
$1 \leq A,B \leq 100$
10+
11+
# Input
12+
1つの入力ファイルは複数のテストケースからなる。
13+
14+
入力ファイルの最初の1行目にはテストケースの個数 $T$ が記される $(1 \leq T \leq 100)$。
15+
16+
2行目以降には、$T$ 個のテストケースが記述されており、各テストケースは次の形式で表される。
17+
18+
```
19+
$A\ B$
20+
```
21+
22+
# Output
23+
各テストケースに対して、`YES`または`NO`を1行ずつ出力せよ。
24+
25+
26+
# Sample Input
27+
```
28+
3
29+
3 3
30+
3 4
31+
3 5
32+
```
33+
34+
# Sample Output
35+
```
36+
YES
37+
YES
38+
NO
39+
```

shimashima/tests/TESTSET

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# -*- coding: utf-8; mode: python -*-
2+
3+
## Input generators.
4+
#c_generator(src='generator.c')
5+
cxx_generator(src='generator.cpp', dependency=['testlib.h'])
6+
#java_generator(src='Generator.java', encoding='UTF-8', mainclass='Generator')
7+
#script_generator(src='generator.pl')
8+
9+
## Input validators.
10+
#c_validator(src='validator.c')
11+
#cxx_validator(src='validator.cc', dependency=['testlib.h'])
12+
#java_validator(src='Validator.java', encoding='UTF-8', mainclass='tmp/validator/Validator')
13+
#script_validator(src='validator.pl')
14+
15+
## Output judges.
16+
#c_judge(src='judge.c')
17+
#cxx_judge(src='judge.cc', dependency=['testlib.h'], variant=testlib_judge_runner)
18+
#java_judge(src='Judge.java', encoding='UTF-8', mainclass='Judge')
19+
#script_judge(src='judge.py')
20+
21+
## Reactives.
22+
#c_reactive(src='reactive.c')
23+
#cxx_reactive(src='reactive.cc', dependency=['testlib.h', 'reactive.hpp'], variant=kupc_reactive_runner)
24+
#java_reactive(src='Reactive.java', encoding='UTF-8', mainclass='Judge')
25+
#script_reactive(src='reactive.py')
26+
27+
## Extra Testsets.
28+
#icpc_merger(input_terminator='0 0\n') # icpc type
29+
#icpc_merger(input_terminator='0 0\n', output_replace=casenum_replace('Case 1', 'Case {0}')) # icpc wf ~2011
30+
#gcj_merger(output_replace=casenum_replace('Case 1', 'Case {0}'))
31+
id='X'
32+
#merged_testset(name=id + '_Merged', input_pattern='*.in')
33+
#subtask_testset(name='All', score=100, input_patterns=['*'])
34+
#scoring_judge() # precisely scored by judge program like Jiyukenkyu (KUPC 2013)

shimashima/tests/constraints.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#define MAX_T 100
2+
#define MIN_AB 1
3+
#define MAX_AB 100

shimashima/tests/generator.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include <fstream>
2+
#include <string>
3+
#include "testlib.h"
4+
#include "constraints.h"
5+
6+
using namespace std;
7+
8+
void generate(const string &file_name, int num_case, int max_num) {
9+
ofstream ofs(file_name);
10+
ofs << num_case <<endl;
11+
12+
for (int i=0; i<num_case; i++) {
13+
ofs << rnd.next(MIN_AB, max_num) << " ";
14+
ofs << rnd.next(MIN_AB, max_num) << endl;
15+
}
16+
}
17+
18+
int main(int argc, char* argv[]) {
19+
registerGen(argc, argv, 1);
20+
21+
generate("small.in", 10, 10);
22+
generate("large.in", MAX_T, MAX_AB);
23+
for (int i=0; i<10; i++) {
24+
generate("random_test" + to_string(i) + ".in", MAX_T, MAX_AB);
25+
}
26+
27+
return 0;
28+
}

shimashima/tests/sample.diff

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
YES
2+
YES
3+
NO

shimashima/tests/sample.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
3
2+
3 3
3+
3 4
4+
3 5

0 commit comments

Comments
 (0)