結果

問題 No.1034 テスターのふっぴーさん
ユーザー ngtkanangtkana
提出日時 2020-03-01 18:02:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 754 bytes
コンパイル時間 893 ms
コンパイル使用メモリ 73,788 KB
実行使用メモリ 817,792 KB
最終ジャッジ日時 2024-04-21 22:20:36
合計ジャッジ時間 3,322 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 15 ms
7,172 KB
testcase_11 AC 15 ms
6,912 KB
testcase_12 AC 11 ms
6,400 KB
testcase_13 AC 15 ms
6,784 KB
testcase_14 AC 10 ms
5,888 KB
testcase_15 AC 12 ms
7,040 KB
testcase_16 AC 8 ms
6,016 KB
testcase_17 AC 12 ms
6,940 KB
testcase_18 AC 13 ms
6,784 KB
testcase_19 AC 13 ms
6,336 KB
testcase_20 MLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
int main(){
    int q;std::cin>>q;
    for(int t=0;t<q;t++){
        int n,I,J;std::cin>>n>>I>>J;
        std::vector<std::vector<int>>a(n,std::vector<int>(n));
        int counter=0;
        int i=0,j=0;
        a.at(0).at(0)=counter++;
        while(j<n-1)a.at(i).at(++j)=counter++;
        for(int k=n-1;k>=1;k--){
            if((n-k)%2==1){
                for(int l=0;l<k;l++)a.at(++i).at(j)=counter++;
                for(int l=0;l<k;l++)a.at(i).at(--j)=counter++;
            }
            if((n-k)%2==0){
                for(int l=0;l<k;l++)a.at(--i).at(j)=counter++;
                for(int l=0;l<k;l++)a.at(i).at(++j)=counter++;
            }
        }
        std::cout<<a.at(I).at(J)<<std::endl;
    }
}

0