제출 #885100

#제출 시각아이디문제언어결과실행 시간메모리
885100txk_2k6새로운 문제 (POI11_roz)C++17
0 / 100
3182 ms65536 KiB
#include <bits/stdc++.h> #define NAME "ssdiff" #define pb push_back #define fi first #define se second #define mp make_pair using namespace std; using ll = long long; using pii = pair<int, int>; void file(){ freopen(NAME".inp","r",stdin); freopen(NAME".out","w",stdout); } int n; string s; const int mx=1e6+5; int dp[30][mx]; int check(int u, int v){ int mx=0, mn=v-u+1; for (int i=1; i<='z'-'a'+1; i++){ int d=dp[i][v]-dp[i][u]; mx=max(mx,d); if (d!=0) mn=min(mn,d); } cout << u<<' '<<v<<' '<<mx<<' '<<mn<<' '<<mx-mn<<'\n'; if (mn>mx) return mx; else return mx-mn; } int main(){ //file(); ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); cin >> n >> s; s=" "+s; for (int i=1; i<='z'-'a'+1; i++) dp[0][i]=0; for (int i=1; i<=n; i++){ for (int j=1; j<='z'-'a'+1; j++){ dp[j][i]=dp[j][i-1]; } dp[s[i]-'a'+1][i]++; } int res=0; for (int i=0; i<n; i++){ for (int j=i+1; j<=n; j++){ res=max(res,check(i,j)); } } cout << res<<'\n'; return 0; }

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

roz.cpp: In function 'void file()':
roz.cpp:14:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     freopen(NAME".inp","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
roz.cpp:15:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     freopen(NAME".out","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#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...
#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...