제출 #631444

#제출 시각아이디문제언어결과실행 시간메모리
631444mdn2002Misspelling (JOI22_misspelling)C++14
28 / 100
128 ms20548 KiB
#include<bits/stdc++.h> using namespace std; long long n , m , in [202] , de [202] , inmx [202] , demx [202] , mod = 1e9 + 7; long long dp [202][202][31]; long long f ( int x , int y , int last ) { if ( x == n + 1 ) return 1; if ( dp [x][y][last] != -1 ) return dp [x][y][last]; long long ans = 0; ans = ( ans = f ( x + 1 , y , last ) ) % mod; int aa = 1 , bb = 1; for ( int j = y ; j < x ; j ++ ) { if ( demx [j] >= x ) aa = 0; if ( inmx [j] >= x ) bb = 0; } if ( aa ) { for ( int i = last + 1 ; i < 26 ; i ++ ) ans = ( ans + f ( x + 1 , x , i ) ) % mod; } if ( bb ) { for ( int i = 0 ; i < last ; i ++ ) ans = ( ans + f ( x + 1 , x , i ) ) % mod; } return dp [x][y][last] = ans; } int main() { memset ( dp , -1 , sizeof dp ); cin >> n >> m; for ( int i = 1 ; i <= n ; i ++ ) { in [i] = 1e9; de [i] = 1e9; } for ( int i = 0 ; i < m ; i ++ ) { long long x , y; cin >> x >> y; if ( x < y ) { de [x] = min ( de [x] , y ); demx [x] = max ( demx [x] , y ); } if ( x > y ) { in [y] = min ( in [y] , x ); inmx [y] = max ( inmx [y] , x ); } } cout << f ( 1 , 0 , 0 ); }

컴파일 시 표준 에러 (stderr) 메시지

misspelling.cpp: In function 'long long int f(int, int, int)':
misspelling.cpp:10:9: warning: operation on 'ans' may be undefined [-Wsequence-point]
   10 |     ans = ( ans = f ( x + 1 , y , last ) ) % mod;
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...