結果

問題 No.675 ドットちゃんたち
コンテスト
ユーザー 👑 kakel-san
提出日時 2026-10-24 20:27:48
言語 C#
(.NET 10.0.402 + ACL)
コンパイル:
dotnet_c
実行:
/usr/bin/dotnet_wrap
結果
TLE  
実行時間 -
コード長 2,586 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 11,440 ms
コンパイル使用メモリ 171,724 KB
実行使用メモリ 72,356 KB
最終ジャッジ日時 2026-10-24 20:28:17
合計ジャッジ時間 18,412 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge7_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 1 TLE * 1 -- * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (291 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net10.0/main.dll
  main -> /home/judge/data/code/bin/Release/net10.0/publish/

ソースコード

diff #
raw source code

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    static long[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, px, py) = ((int)c[0], c[1], c[2]);
        var map = NArr(n);
        var ans = Dots(n, px, py, map);
        WriteLine(string.Join("\n", ans.Select(ai => $"{ai.X} {ai.Y}")));
    }
    static Data[] Dots(int n, long px, long py, long[][] map)
    {
        var seg = new AtCoder.LazySegtree<Data, Func, SegOp>(n);
        for (var i = 0; i < n; ++i)
        {
            seg[i] = new Data(px, py);
            if (map[i][0] == 1)  seg.Apply(0, n, new Func(0, map[i][1], 0));
            else if (map[i][0] == 2) seg.Apply(0, n, new Func(0, 0, map[i][1]));
            else seg.Apply(0, n, new Func(1, 0, 0));
        }
        var ans = new Data[n];
        for (var i = 0; i < n; ++i)
        {
            ans[i] = seg[i];
        }
        return ans;
    }
    struct Data
    {
        public long X;
        public long Y;
        public Data(long x, long y)
        {
            X = x; Y = y;
        }
    }
    struct Func
    {
        public int Rotate;
        public long X;
        public long Y;
        public Func (int r, long x, long y)
        {
            Rotate = r; X = x; Y = y;
        }
    }
    struct SegOp : AtCoder.ILazySegtreeOperator<Data, Func>
    {
        public Data Identity => new Data(0, 0);
        public Func FIdentity => new Func(0, 0, 0);
        public Func Composition(Func nf, Func cf)
        {
            var cx = cf.X;
            var cy = cf.Y;
            var nr = nf.Rotate;
            while (nr > 0)
            {
                (cx, cy) = (cy, -cx);
                --nr;
            }
            return new Func(cf.Rotate + nf.Rotate, cx + nf.X, cy + nf.Y);
        }
        public Data Mapping(Func f, Data x)
        {
            var cx = x.X;
            var cy = x.Y;
            var nr = f.Rotate;
            while (nr > 0)
            {
                (cx, cy) = (cy, -cx);
                --nr;
            }
            return new Data(cx + f.X, cy + f.Y);
        }
        public Data Operate(Data x, Data y)
        {
            return x;
        }
    }
}
0