結果
| 問題 |
No.833 かっこいい電車
|
| コンテスト | |
| ユーザー |
No
|
| 提出日時 | 2019-06-20 19:11:09 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 2,285 bytes |
| コンパイル時間 | 2,251 ms |
| コンパイル使用メモリ | 112,708 KB |
| 実行使用メモリ | 64,160 KB |
| 最終ジャッジ日時 | 2024-07-02 03:58:57 |
| 合計ジャッジ時間 | 9,000 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | TLE * 1 -- * 29 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
namespace a
{
class y
{
static void Main(string[] args)
{
var ss = Console.ReadLine().Split();
var n = int.Parse(ss[0]);
var q = int.Parse(ss[1]);
var a = new long[n + 1];
var c = new bool[n + 1];
var ans = "";
ss =Console.ReadLine().Split();
for (int i = 0; i < ss.Length; i++)
{
a[i + 1] = long.Parse(ss[i]);
}
for (int i = 0; i < q; i++)
{
ss = Console.ReadLine().Split();
switch (ss[0])
{
case "1":
if (int.Parse(ss[1]) < n)
{
c[int.Parse(ss[1]) + 1] = true;
}
break;
case "2":
if (int.Parse(ss[1]) < n)
{
c[int.Parse(ss[1]) + 1] = false;
}
break;
case "3":
if (int.Parse(ss[1]) < n + 1)
{
a[int.Parse(ss[1])]++;
}
break;
case "4":
long w = 0;
if (int.Parse(ss[1]) < n + 1)
{
w = a[int.Parse(ss[1])];
var y = int.Parse(ss[1]) + 1;
while (y < n + 1 && c[y])
{
w += a[y];
y++;
}
y = int.Parse(ss[1]);
while (c[y])
{
w += a[int.Parse(ss[1]) - 1];
y--;
}
}
ans += w.ToString() + "\n";
break;
default:
break;
}
}
Console.WriteLine(ans);
}
}
}
No