Submission #263602

#TimeUsernameProblemLanguageResultExecution timeMemory
263602shrek12357Poi (IOI09_poi)C++14
100 / 100
1086 ms23928 KiB
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #include <set> #include <climits> #include <cmath> #include <fstream> #include <queue> using namespace std; struct state { int score; int numTasks; int index; }; bool comp(state state1, state state2) { if (state1.score != state2.score) { return state1.score > state2.score; } if (state1.numTasks != state2.numTasks) { return state1.numTasks > state2.numTasks; } return state1.index < state2.index; } #define MAXN 2005 int main() { int n, t, p; cin >> n >> t >> p; int dp[MAXN][MAXN]; int tasks[MAXN]; for (int i = 0; i < t; i++) { tasks[i] = 0; } for (int i = 0; i < n; i++) { for (int j = 0; j < t; j++) { int temp; cin >> temp; if (temp == 0) { tasks[j]++; } dp[i][j] = temp; } } vector<state> people; for (int i = 0; i < n; i++) { int curScore = 0, counter = 0; for (int j = 0; j < t; j++) { if (dp[i][j] == 1) { counter++; curScore += tasks[j]; } } state temp = { curScore, counter, i + 1}; people.push_back(temp); } sort(people.begin(), people.end(), comp); int ansScore = 0, ansIdx = 0; for (int i = 0; i < people.size(); i++) { if (people[i].index == p) { ansScore = people[i].score; ansIdx = i + 1; } } cout << ansScore << " " << ansIdx << endl; }

Compilation message (stderr)

poi.cpp: In function 'int main()':
poi.cpp:63:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<state>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |  for (int i = 0; i < people.size(); i++) {
      |                  ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...