Skip to content

Commit

Permalink
add GENERAL-48
Browse files Browse the repository at this point in the history
  • Loading branch information
YusukeKato committed Jan 4, 2025
1 parent f69a2f9 commit aa61d5b
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 19 deletions.
14 changes: 9 additions & 5 deletions client/html/index.en.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@


<title>シェル芸オンラインジャッジ / SHELLGEI ONLINE JUDGE</title>
<link rel="icon" href="https://shellgei-online-judge.com/favicon.jpg?version=1106">
<link rel="stylesheet" href="https://shellgei-online-judge.com/style.css?version=1106">
<link rel="icon" href="https://shellgei-online-judge.com/favicon.jpg?version=1107">
<link rel="stylesheet" href="https://shellgei-online-judge.com/style.css?version=1107">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:[email protected]&display=swap" rel="stylesheet">
Expand Down Expand Up @@ -55,8 +55,8 @@ <h1 class="heading-028" data-label="SHELLGEI ONLINE JUDGE">Shell one-liner playg
<h2>INFORMATION</h2>
<h3>LAST UPDATED</h3>
<ul>
<li>- date: 2025/01/02</li>
<li>- version: 1.1.1</li>
<li>- date: 2025/01/04</li>
<li>- version: 1.1.2</li>
</ul>

<h3>NEWS</h3>
Expand Down Expand Up @@ -130,6 +130,7 @@ <h3>How to play</h3>
<details>
<summary>2025</summary>
<ul>
<li>- 01/04: GENERAL-48追加</li>
<li>- 01/02: サーバメンテナンス、問題追加</li>
</ul>
</details>
Expand Down Expand Up @@ -368,6 +369,8 @@ <h3>Answer</h3>
<div class="codeClass"><pre><code class="mono-font2">cat input.txt | awk '{for(i=0;i&lt;$1;i++){for(j=0;j&lt;$1;j++){if(i==j){printf("1")}else{printf("0")}}printf("\n")}}'</code></pre></div>
<p>47</p>
<div class="codeClass"><pre><code class="mono-font2">cat input.txt | sed "s/ /\n/g" | grep -E "[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+"</code></pre></div>
<p>48</p>
<div class="codeClass"><pre><code class="mono-font2">cat input.txt | tr -d '\n' | sed 's/\([a-z]\)/\1\n/g' | uniq -c | awk '{print $2,$1}' | tr -d ' ' | tr -d '\n'</code></pre></div>
</details>
</details>

Expand Down Expand Up @@ -543,6 +546,7 @@ <h3 id="generalProblem">General</h3>
<option value="GENERAL-00000045">45 : Pattern 3</option>
<option value="GENERAL-00000046">46 : Create Identity Matrix</option>
<option value="GENERAL-00000047">47 : IP address extraction</option>
<option value="GENERAL-00000048">48 : String compression</option>
</select>
</label>
<p></p>
Expand Down Expand Up @@ -721,7 +725,7 @@ <h3>Executed Shell-gei</h3>
<script>
var is_jp = false;
</script>
<script src="https://shellgei-online-judge.com/index.js?version=1106"></script>
<script src="https://shellgei-online-judge.com/index.js?version=1107"></script>
</div> <!-- alldiv -->
<h1 class="heading-028-2" data-label="">GitHub - <a href="https://github.com/YusukeKato/ShellgeiOnlineJudge/discussions" class="white-link">SHELLGEI ONLINE JUDGE Discussions</a><br>&copy; 2023 YusukeKato All rights reserved.</h1>
</body>
Expand Down
14 changes: 9 additions & 5 deletions client/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@


<title>シェル芸オンラインジャッジ / SHELLGEI ONLINE JUDGE</title>
<link rel="icon" href="https://shellgei-online-judge.com/favicon.jpg?version=1106">
<link rel="stylesheet" href="https://shellgei-online-judge.com/style.css?version=1106">
<link rel="icon" href="https://shellgei-online-judge.com/favicon.jpg?version=1107">
<link rel="stylesheet" href="https://shellgei-online-judge.com/style.css?version=1107">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:[email protected]&display=swap" rel="stylesheet">
Expand Down Expand Up @@ -55,8 +55,8 @@ <h1 class="heading-028" data-label="SHELLGEI ONLINE JUDGE">シェル・ワンラ
<h2>概要</h2>
<h3>最終更新日</h3>
<ul>
<li>- date: 2025/01/02</li>
<li>- version: 1.1.1</li>
<li>- date: 2025/01/04</li>
<li>- version: 1.1.2</li>
</ul>

<h3>お知らせ</h3>
Expand Down Expand Up @@ -130,6 +130,7 @@ <h3>遊び方</h3>
<details>
<summary>2025</summary>
<ul>
<li>- 01/04: GENERAL-48追加</li>
<li>- 01/02: サーバメンテナンス、問題追加</li>
</ul>
</details>
Expand Down Expand Up @@ -368,6 +369,8 @@ <h3>回答例</h3>
<div class="codeClass"><pre><code class="mono-font2">cat input.txt | awk '{for(i=0;i&lt;$1;i++){for(j=0;j&lt;$1;j++){if(i==j){printf("1")}else{printf("0")}}printf("\n")}}'</code></pre></div>
<p>47</p>
<div class="codeClass"><pre><code class="mono-font2">cat input.txt | sed "s/ /\n/g" | grep -E "[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+"</code></pre></div>
<p>48</p>
<div class="codeClass"><pre><code class="mono-font2">cat input.txt | tr -d '\n' | sed 's/\([a-z]\)/\1\n/g' | uniq -c | awk '{print $2,$1}' | tr -d ' ' | tr -d '\n'</code></pre></div>
</details>
</details>

Expand Down Expand Up @@ -543,6 +546,7 @@ <h3 id="generalProblem">通常問題</h3>
<option value="GENERAL-00000045">45 : 模様の描画3</option>
<option value="GENERAL-00000046">46 : 単位行列の生成</option>
<option value="GENERAL-00000047">47 : IPアドレスの抽出</option>
<option value="GENERAL-00000048">48 : 文字列の圧縮</option>
</select>
</label>
<p></p>
Expand Down Expand Up @@ -721,7 +725,7 @@ <h3>実行したシェル芸</h3>
<script>
var is_jp = true;
</script>
<script src="https://shellgei-online-judge.com/index.js?version=1106"></script>
<script src="https://shellgei-online-judge.com/index.js?version=1107"></script>
</div> <!-- alldiv -->
<h1 class="heading-028-2" data-label="">GitHub - <a href="https://github.com/YusukeKato/ShellgeiOnlineJudge/discussions" class="white-link">SHELLGEI ONLINE JUDGE Discussions</a><br>&copy; 2023 YusukeKato All rights reserved.</h1>
</body>
Expand Down
2 changes: 1 addition & 1 deletion client/js/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// パラメータ
var version = 1067;
var version = 1068;
const limit_length = parseInt(1000);
var mainUrl = 'https://shellgei-online-judge.com/';
var is_enable_button = true;
Expand Down
9 changes: 6 additions & 3 deletions client/scripts/generate_index_html.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
update_date = "2025/01/02"
current_version = "1.1.1"
version_str = "?version=1106"
update_date = "2025/01/04"
current_version = "1.1.2"
version_str = "?version=1108"

site_title = "シェル芸オンラインジャッジ / SHELLGEI ONLINE JUDGE"
summary_url = "https://yusukekato.jp/images/summary.jpg"
Expand Down Expand Up @@ -252,6 +252,7 @@ def write_index_html(lang):
lines.append('<details>\n')
lines.append('<summary>2025</summary>\n')
lines.append('<ul>\n')
lines.append('<li>- 01/04: GENERAL-48追加</li>\n')
lines.append('<li>- 01/02: サーバメンテナンス、問題追加</li>\n')
lines.append('</ul>\n')
lines.append('</details>\n')
Expand Down Expand Up @@ -553,6 +554,7 @@ def write_index_html(lang):
lines.append('<option value="GENERAL-00000045">45 : 模様の描画3</option>\n')
lines.append('<option value="GENERAL-00000046">46 : 単位行列の生成</option>\n')
lines.append('<option value="GENERAL-00000047">47 : IPアドレスの抽出</option>\n')
lines.append('<option value="GENERAL-00000048">48 : 文字列の圧縮</option>\n')
lines.append('</select>\n')
lines.append('</label>\n')
lines.append('<p></p>\n')
Expand Down Expand Up @@ -614,6 +616,7 @@ def write_index_html(lang):
lines.append('<option value="GENERAL-00000045">45 : Pattern 3</option>\n')
lines.append('<option value="GENERAL-00000046">46 : Create Identity Matrix</option>\n')
lines.append('<option value="GENERAL-00000047">47 : IP address extraction</option>\n')
lines.append('<option value="GENERAL-00000048">48 : String compression</option>\n')
lines.append('</select>\n')
lines.append('</label>\n')
lines.append('<p></p>\n')
Expand Down
1 change: 1 addition & 0 deletions data/answer/GENERAL-00000048.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cat input.txt | tr -d '\n' | sed 's/\([a-z]\)/\1\n/g' | uniq -c | awk '{print $2,$1}' | tr -d ' ' | tr -d '\n'
1 change: 1 addition & 0 deletions data/input/GENERAL-00000048.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aaabbcccccdeeeefghhiijjjkkkkkk
1 change: 1 addition & 0 deletions data/output/GENERAL-00000048.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a3b2c5d1e4f1g1h2i2j3k6
1 change: 1 addition & 0 deletions data/problem_en/GENERAL-00000048.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replace consecutive identical characters in the string with their counts.
Binary file added data/problem_images/GENERAL-00000048.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions data/problem_jp/GENERAL-00000048.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
文字列の中で連続している文字を個数に置き換えてください。
2 changes: 1 addition & 1 deletion data/scripts/cnt_general_num.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
47
48
2 changes: 1 addition & 1 deletion scripts/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
print("start test: server")

def test_func(shellgei, problemNum, is_correct):
time.sleep(1)
time.sleep(3.0)
data = {
"shellgei": shellgei,
"problemNum": problemNum
Expand Down
11 changes: 8 additions & 3 deletions server/connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
// 時間管理
$filename_time_ms = '../shellgei_time_ms.txt';
$shellgei_oldtime_ms = file_get_contents($filename_time_ms);
$shellgei_newtime_ms = microtime(true);;
$time_ms_diff = (int)((int)$shellgei_newtime_ms - (int)$shellgei_oldtime_ms);
if($time_ms_diff < 0.1) {
$shellgei_newtime_ms = microtime(true);
$time_ms_diff = (float)((float)$shellgei_newtime_ms - (float)$shellgei_oldtime_ms);
// file_put_contents("../debug_time_ms_diff.txt", $time_ms_diff, LOCK_EX);
if($time_ms_diff < (float)0.1) {
$res['shellgei'] = "The server is busy(0.1s).";
$res['shellgei_id'] = "-1";
$res['shellgei_date'] = $shellgei_newtime;
Expand Down Expand Up @@ -158,3 +159,7 @@
$res['shellgei_image'] = $output_image_base64;
$res['shellgei_judge'] = $judge_result;
echo json_encode($res);

// 時刻を記録
// $shellgei_newtime_ms = microtime(true);
// file_put_contents($filename_time_ms, $shellgei_newtime_ms, LOCK_EX);

0 comments on commit aa61d5b

Please sign in to comment.