제출 #814786

#제출 시각아이디문제언어결과실행 시간메모리
814786waldiMisspelling (JOI22_misspelling)C++17
8 / 100
4027 ms1048576 KiB
#include<bits/stdc++.h> #define FOR(i,p,k) for(int i=(p);i<=(k);++i) #define REP(i,n) FOR(i,0,(n)-1) #define pii pair<int, int> #define fi first #define se second #define mod 1000000007 typedef long long ll; using namespace std; struct modular{ int a; modular(int x = 0){a = x;} modular operator+(modular t){return {(a+t.a)%mod};} void operator+=(modular t){a = (a+t.a)%mod;} }; int main(){ int n, m; scanf("%d%d", &n, &m); vector<pii> wym; while(m--){ int a, b; scanf("%d%d", &a, &b); wym.emplace_back(a, b); } vector<vector<vector<modular>>> dp(n+1, vector<vector<modular>>(n+1, vector<modular>(26, 0))); REP(lit, 26) dp[1][1][lit] = 1; FOR(poc, 1, n) FOR(kon, poc, n-1) REP(lit, 26){ modular t = dp[poc][kon][lit]; dp[poc][kon+1][lit] += t; REP(nowa, 26) if(nowa != lit){ bool git = 1; for(pii i : wym){ int p = min(i.fi, i.se); int k = max(i.fi, i.se); if(poc<=p&&p<=kon && kon<k){ if((lit<nowa) != (i.se<i.fi)) git = 0; } } if(git) dp[kon+1][kon+1][nowa] += t; } } modular wyn = 0ll; FOR(poc, 1, n) REP(lit, 26) wyn += dp[poc][n][lit]; printf("%d", wyn.a); }

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

misspelling.cpp: In function 'int main()':
misspelling.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |  scanf("%d%d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~
misspelling.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |   scanf("%d%d", &a, &b);
      |   ~~~~~^~~~~~~~~~~~~~~~
#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...