제출 #221392

#제출 시각아이디문제언어결과실행 시간메모리
221392anonymousFish (IOI08_fish)C++14
컴파일 에러
0 ms0 KiB
#include<iostream> #include<algorithm> #include<utility> #define MAXN 500005 #define fi first #define se second using namespace std; int F, K, M, B[MAXN], Num[MAXN], Ans; pair<int,int> Fish[MAXN]; vector<int> S[MAXN]; int main() { //freopen("fishin.txt","r",stdin); scanf("%d\n%d\n%d",&F,&K,&M); for (int i=1; i<=F; i++) { scanf("%d %d",&Fish[i].first, &Fish[i].second); } sort(Fish+1, Fish+F+1); for (int i=1; i<=F; i++) { B[Fish[i].se] = Fish[i].fi; S[Fish[i].se].push_back(Fish[i].fi); } for (int t1=1; t1<=K; t1++) { int nxt; for (int i=1; i<=F; i++) { Num[i] = 0; } for (int i=1; i<=F; i++) { if (Fish[i].fi * 2 <= B[t1]) { Num[Fish[i].se] += 1; } else if (Fish[i].se == t1) { nxt = Fish[i].fi; break; } } Num[t1] += 1; int Max = 1, NonMax = 1; for (int t2=1; t2 <= K; t2 ++) { if (t1 == t2) { NonMax = (NonMax * (Num[t1] - 1)) %M; } else { if (B[t2] < 2*nxt) { if (B[t2] < B[t1] || (B[t2] == B[t1] && t2 < t1)) { NonMax = (NonMax * (Num[t2] + 1)) %M; } Max = (Max * (Num[t2] + 1)) % M; } } } //printf("%d %d %d %d\n",t1,nxt,Max,NonMax); Ans = (Ans + Max + NonMax) % M; } printf("%d", Ans); }

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

fish.cpp:10:1: error: 'vector' does not name a type; did you mean 'perror'?
 vector<int> S[MAXN];
 ^~~~~~
 perror
fish.cpp: In function 'int main()':
fish.cpp:20:9: error: 'S' was not declared in this scope
         S[Fish[i].se].push_back(Fish[i].fi);
         ^
fish.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d\n%d\n%d",&F,&K,&M);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
fish.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d",&Fish[i].first, &Fish[i].second);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~