제출 #624965

#제출 시각아이디문제언어결과실행 시간메모리
624965StavabSails (IOI07_sails)C++14
15 / 100
1093 ms1904 KiB
#include <iostream> #include <vector> #include <stack> #include <utility> using namespace std; int main() { int n; scanf("%d", &n); vector<int> rows(100005, 0); int h, k; stack<pair<int, int>> input; while(n--) { scanf("%d %d", &h, &k); input.push(make_pair(h, k)); } long long sum = 0; vector<int> put(100005); while(!input.empty()) { int toFill = input.top().second; int height = input.top().first; for(int i = 1; i <= height; i++) put[i] = 0; for(int i = 0; i <= 100005; i++) { for(int j = height; j > 0; j--) { if(!put[j] && rows[j] == i) { sum += rows[j]; put[j] = 1; rows[j]++; toFill--; } if(!toFill) break; } if(!toFill) break; } input.pop(); } cout << sum << "\n"; return 0; }

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

sails.cpp: In function 'int main()':
sails.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
sails.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         scanf("%d %d", &h, &k);
      |         ~~~~~^~~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...