제출 #1328337

#제출 시각아이디문제언어결과실행 시간메모리
1328337SmuggingSpunMisspelling (JOI22_misspelling)C++20
28 / 100
687 ms9060 KiB
#include<bits/stdc++.h>
#define taskname "C"
using namespace std;
const int mod = 1e9 + 7;
template<class T>void maximize(T& a, T b){
  if(a < b){
    a = b;
  }
}
void add(int& a, int b){
  if((a += b) >= mod){
    a -= mod;
  }
}
int get_sub(int a, int b){
  return (a -= b) < 0 ? a + mod : a;
}
int n, m;
namespace sub12{
  const int lim = 202;
  int lar[lim], sma[lim], f[lim][lim][27], nf[lim][lim][27];
  void solve(){
    memset(lar, 0, sizeof(lar));
    memset(sma, 0, sizeof(sma));
    for(int _ = 0; _ < m; _++){
      int a, b;
      cin >> a >> b;
      if(a < b){
        maximize(lar[a], b);
      }
      else{
        maximize(sma[b], a);
      }
    }
    for(int i = 0; i <= n; i++){
      for(int j = 0; j <= n; j++){
        iota(f[i][j], f[i][j] + 27, 0);
      }
    }
    for(int i = n; i > 1; i--){
      memset(nf, 0, sizeof(nf));
      for(int j = 0; j <= n; j++){
        for(int k = 0; k <= n; k++){
          for(int pre = 1; pre < 27; pre++){
            nf[j][k][pre] = get_sub(f[max(j, lar[i])][max(k, sma[i])][pre], f[max(j, lar[i])][max(k, sma[i])][pre - 1]);
            if(i > j){
              add(nf[j][k][pre], f[lar[i]][sma[i]][pre - 1]);
            }
            if(i > k){
              add(nf[j][k][pre], get_sub(f[lar[i]][sma[i]][26], f[lar[i]][sma[i]][pre]));
            }
          }
        }
      }
      memcpy(f, nf, sizeof(f));
      for(int j = 0; j <= n; j++){
        for(int k = 0; k <= n; k++){
          for(int t = 1; t < 27; t++){
            add(f[j][k][t], f[j][k][t - 1]);
          }
        }
      }
    }
    cout << f[lar[1]][sma[1]][26];
  }
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	if(fopen(taskname".inp", "r")){
		freopen(taskname".inp", "r", stdin);
	}
  cin >> n >> m;
  if(n <= 200){
    sub12::solve();
  }
  else{
  }
}

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

misspelling.cpp: In function 'int main()':
misspelling.cpp:70:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   70 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...