제출 #1114400

#제출 시각아이디문제언어결과실행 시간메모리
1114400ttamxMisspelling (JOI22_misspelling)C++17
100 / 100
2398 ms60284 KiB
#include<bits/stdc++.h> #pragma GCC oprimize("Ofast,unroll-loops") using namespace std; const int L=26; const int N=5e5+5; const int MOD=1e9+7; int n,m; int dp[N][L]; vector<pair<int,int>> a[2]; int pre[N][2]; int norm(int x){ if(x<0)x+=MOD; if(x>=MOD)x-=MOD; return x; } int main(){ cin.tie(nullptr)->sync_with_stdio(false); cin >> n >> m; for(int i=0;i<m;i++){ int l,r; cin >> l >> r; a[l>r].emplace_back(max(l,r),min(l,r)); } for(int t=0;t<2;t++){ sort(a[t].begin(),a[t].end()); priority_queue<int> pq; pq.emplace(0); for(int i=n;i>=1;i--){ while(!a[t].empty()&&a[t].back().first>=i){ pq.emplace(a[t].back().second); a[t].pop_back(); } while(pq.top()>=i){ pq.pop(); } pre[i][t]=pq.top(); } } for(int i=0;i<26;i++){ dp[1][i]=1; } for(int i=2;i<=n;i++){ for(int j=0;j<26;j++){ dp[i][j]=dp[i-1][j]; for(int k=0;k<26;k++){ if(j==k)continue; int s=j<k; dp[i][j]=norm(norm(dp[i][j]+dp[i-1][k])-dp[pre[i][s]][k]); } } } int ans=0; for(int i=0;i<26;i++){ ans=norm(ans+dp[n][i])%MOD; } cout << ans; }

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

misspelling.cpp:2: warning: ignoring '#pragma GCC oprimize' [-Wunknown-pragmas]
    2 | #pragma GCC oprimize("Ofast,unroll-loops")
      |
#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...