Submission #55486868


Source Code Expand

#ifndef INCLUDED_MAIN
#define INCLUDED_MAIN

#include __FILE__
int main(){
    // Write here!
    ll N, M;
    cin >> N >> M;
    ll si, sj = -1;
    bool ans = true;
    /*
     1  2  3  4  5  6  7
     8  9 10 11 12 13 14
            ↓ -1
     0  1  2  3  4  5  6  : 0
     7  8  9 10 11 12 13  : 1
    */
    rep(i,N){
        rep(j,M){
            ll B;
            cin >> B;
            if(i+j==0){
                // 一番最初
                // B[0][0]より(i-1)x7+jのi,jを求める
                sj = (B-1)%7; // WA: ここでB-1にするのを忘れていた
                // 1から7なら一行目 → x-1/7
                si = (B-1)/7;
            }else{
                // WA: 8行目以降を考慮していなかった
                if(j+sj>=7) ans = false;
                if(B!=(si+i)*7+(j+sj)+1) ans = false;
            }
        }
    }
    yn(ans);
    return 0;
}

#else
#include<bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

using ll = long long;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define reps(i,s,n) for(ll i=(s); i<(n); i++)
#define all(x) (x).begin(),(x).end()
#define lb_ind(a,key) lower_bound(all((a)), (key)) - (a).begin()
#define llvec(a,n) vector<ll> (a)((n))
#define yn(flg) cout<<(flg?"Yes":"No")<<endl;

#endif

Submission Info

Submission Time
Task C - Calendar Validator
User YTa09
Language C++ 23 (gcc 12.2)
Score 300
Code Size 1307 Byte
Status AC
Exec Time 17 ms
Memory 3716 KiB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:31:26: warning: ‘si’ may be used uninitialized [-Wmaybe-uninitialized]
   31 |                 if(B!=(si+i)*7+(j+sj)+1) ans = false;
      |                       ~~~^~~
Main.cpp:9:8: note: ‘si’ was declared here
    9 |     ll si, sj = -1;
      |        ^~

Judge Result

Set Name Sample All after_contest
Score / Max Score 0 / 0 300 / 300 0 / 0
Status
AC × 3
AC × 26
AC × 2
Set Name Test Cases
Sample example0.txt, example1.txt, example2.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, example0.txt, example1.txt, example2.txt
after_contest after_contest0.txt, after_contest1.txt
Case Name Status Exec Time Memory
000.txt AC 17 ms 3480 KiB
001.txt AC 1 ms 3568 KiB
002.txt AC 3 ms 3480 KiB
003.txt AC 1 ms 3540 KiB
004.txt AC 4 ms 3432 KiB
005.txt AC 10 ms 3516 KiB
006.txt AC 3 ms 3508 KiB
007.txt AC 1 ms 3432 KiB
008.txt AC 2 ms 3536 KiB
009.txt AC 11 ms 3436 KiB
010.txt AC 15 ms 3716 KiB
011.txt AC 17 ms 3576 KiB
012.txt AC 17 ms 3564 KiB
013.txt AC 6 ms 3628 KiB
014.txt AC 6 ms 3568 KiB
015.txt AC 1 ms 3520 KiB
016.txt AC 1 ms 3524 KiB
017.txt AC 1 ms 3524 KiB
018.txt AC 1 ms 3516 KiB
019.txt AC 4 ms 3480 KiB
020.txt AC 11 ms 3556 KiB
021.txt AC 10 ms 3484 KiB
022.txt AC 7 ms 3532 KiB
after_contest0.txt AC 1 ms 3432 KiB
after_contest1.txt AC 1 ms 3564 KiB
example0.txt AC 1 ms 3480 KiB
example1.txt AC 1 ms 3572 KiB
example2.txt AC 1 ms 3508 KiB