제출 #981366

#제출 시각아이디문제언어결과실행 시간메모리
981366pcc무지개나라 (APIO17_rainbow)C++17
12 / 100
1382 ms12380 KiB
#include "rainbow.h" #include <bits/stdc++.h> using namespace std; #define pii pair<int,int> #define fs first #define sc second const int mxn = 2e5+10; int arr[3][mxn]; int pref[mxn]; int row[3][mxn]; bool block(int a,int b){ return a==-1&&b==-1; } void init(int R, int C, int sr, int sc, int M, char *S) { memset(pref,0,sizeof(pref)); memset(row,0,sizeof(row)); memset(arr,0,sizeof(arr)); pii now = pii(sr,sc); arr[now.fs][now.sc] = -1; for(int i = 0;i<M;i++){ if(S[i] == 'N')now.fs--; else if(S[i] == 'S')now.fs++; else if(S[i] == 'E')now.sc++; else if(S[i] == 'W')now.sc--; arr[now.fs][now.sc] = -1; } for(int i = 1;i<=R;i++){ for(int j = 1;j<=C;j++)cerr<<setw(2)<<arr[i][j]<<' ';cerr<<endl; }cerr<<endl; arr[2][0] = arr[1][0] = -1; for(int i = 1;i<=C;i++){ row[1][i] = row[1][i-1]; row[2][i] = row[2][i-1]; pref[i] = pref[i-1]; if(!arr[1][i]&&arr[1][i-1])row[1][i]++; if(!arr[2][i]&&arr[2][i-1])row[2][i]++; if(!block(arr[1][i],arr[2][i])&&block(arr[1][i-1],arr[2][i-1]))pref[i]++; } for(int i =1;i<=C;i++)cerr<<pref[i]<<' ';cerr<<endl; return; } int colour(int ar, int ac, int br, int bc) { if(ar == br){ int cnt = row[ar][bc]-row[ar][ac]; if(!arr[ar][ac])cnt++; return cnt; } else{ int cnt = pref[bc]-pref[ac]; if(!block(arr[ar][ac],arr[br][ac]))cnt++; return cnt; } }

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

rainbow.cpp: In function 'void init(int, int, int, int, int, char*)':
rainbow.cpp:32:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   32 |   for(int j = 1;j<=C;j++)cerr<<setw(2)<<arr[i][j]<<' ';cerr<<endl;
      |   ^~~
rainbow.cpp:32:56: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   32 |   for(int j = 1;j<=C;j++)cerr<<setw(2)<<arr[i][j]<<' ';cerr<<endl;
      |                                                        ^~~~
rainbow.cpp:44:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   44 |  for(int i =1;i<=C;i++)cerr<<pref[i]<<' ';cerr<<endl;
      |  ^~~
rainbow.cpp:44:43: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   44 |  for(int i =1;i<=C;i++)cerr<<pref[i]<<' ';cerr<<endl;
      |                                           ^~~~
#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...