제출 #60919

#제출 시각아이디문제언어결과실행 시간메모리
60919ksun48Homecoming (BOI18_homecoming)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long LL; int n; int q; string s; vector<int> psums; int max_psum(int a, int b){ int z = 0; for(int i = a; i <= b; i++){ for(int j = i; j <= b; j++){ z = max(psums[j] - psums[i], z); } } return z; } int main(){ cin.sync_with_stdio(0); cin.tie(0); cin >> n >> s >> q; psums.push_back(0); for(int i = 0; i < s.size(); i++){ if(s[i] == 'C'){ psums.push_back(psums[psums.size() - 1] + 1); } else { psums.push_back(psums[psums.size() - 1] - 1); } } for(int i = 0; i < q; i++){ int l, r; cin >> l >> r; l--; r--; r++; int a = max_psum(l, r); cout << a - (psums[r] - psums[l]) << '\n'; } }

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

homecoming.cpp: In function 'int main()':
homecoming.cpp:22:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < s.size(); i++){
                 ~~^~~~~~~~~~
/tmp/cchiET3J.o: In function `main':
homecoming.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccL5hl9c.o:grader.cpp:(.text.startup+0x0): first defined here
/tmp/ccL5hl9c.o: In function `main':
grader.cpp:(.text.startup+0xff): undefined reference to `solve(int, int, int*, int*)'
collect2: error: ld returned 1 exit status