Please sign in first.
Submission #564184
Source Code Expand
using System;
class Program
{
static void Main (string[] args)
{
int n = int.Parse(Console.ReadLine());
string inputs = Console.ReadLine();
int bunkaiNum = 0;
int netaStock = 0;
int shariStock = 0;
for (int i = 0; i < 2*n; i++)
{
if (inputs.Length - i < 2)
{
break;
}
switch(inputs.Substring(i, 2))
{
case "01":
i++;
break;
case "10":
i++;
break;
case "00":
if (shariStock > 0)
{
shariStock--;
}else{
netaStock++;
bunkaiNum++;
}
break;
case "11":
if (netaStock > 0)
{
netaStock--;
}else{
shariStock++;
bunkaiNum++;
}
break;
}
}
Console.WriteLine(bunkaiNum);
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - 寿司タワー |
| User | ryosukeAtGT |
| Language | C# (Mono 3.2.1.0) |
| Score | 100 |
| Code Size | 780 Byte |
| Status | AC |
| Exec Time | 118 ms |
| Memory | 8888 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 100 / 100 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample-01.txt, sample-02.txt |
| All | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01-01.txt | AC | 118 ms | 8872 KiB |
| 01-02.txt | AC | 116 ms | 8868 KiB |
| 01-03.txt | AC | 115 ms | 8868 KiB |
| 01-04.txt | AC | 118 ms | 8868 KiB |
| 01-05.txt | AC | 116 ms | 8864 KiB |
| 01-06.txt | AC | 115 ms | 8868 KiB |
| 01-07.txt | AC | 114 ms | 8888 KiB |
| 01-08.txt | AC | 115 ms | 8880 KiB |
| 01-09.txt | AC | 116 ms | 8880 KiB |
| 01-10.txt | AC | 116 ms | 8872 KiB |
| 01-11.txt | AC | 117 ms | 8872 KiB |
| 01-12.txt | AC | 117 ms | 8880 KiB |
| 01-13.txt | AC | 117 ms | 8880 KiB |
| 01-14.txt | AC | 116 ms | 8848 KiB |
| 01-15.txt | AC | 115 ms | 8880 KiB |
| 01-16.txt | AC | 115 ms | 8796 KiB |
| sample-01.txt | AC | 115 ms | 8884 KiB |
| sample-02.txt | AC | 116 ms | 8884 KiB |