답안 #757991

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
757991 2023-06-14T04:16:25 Z BentoOreo Fruits (NOI22_fruits) C++14
0 / 100
59 ms 7664 KB
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <unordered_map>
#include <deque>
#include <set>
#include <unordered_set>
#include <algorithm>
#define ll long long
using namespace std;
int max_count = 0;
unordered_map<int,pair<ll,ll> > copygarbage;
void recurse(unordered_map<int,pair<ll,ll> > gyms, ll level, int count){
    if(gyms.size() == 0){
        max_count = max(max_count,count);
    } else {
        for(auto elem: gyms){
            if(level <= elem.second.first){//if level less than level cap
                copygarbage = gyms;
                copygarbage.erase(elem.first);
                recurse(copygarbage, level + elem.second.second, count + 1);
            }
        }
        max_count = max(max_count,count);//if I exhaust all I still need to check lol
    }
}
int main(){
    //subtask 1 of problem 2 complete search dfs
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int len;
    cin >> len;
    vector<int> fruits;
    unordered_set <int> stuff;
    vector<pair<int,int> > ct;
    int hold;
    for(int i = 0; i < len; i++){
        cin >> hold;
        stuff.insert(hold);
    }
    for(int i = 0; i < len; i++){
        cin >> hold;
        ct.push_back({hold,i});//sort by cost/tastiness 
    }
    if(stuff.size() == 1 && *stuff.begin() == -1){
        sort(ct.begin(),ct.end(), [&](const auto &a, const auto &b){
            return a.first * b.second > b.first * a.second;
        });
        int sum = 0;
        char c;
        for(int i = 0; i < ct.size(); i++){
            sum += ct.at(i).first;
            if(i == ct.size()-1){
                c = '\n';
            } else {
                c = ' ';
            }
            cout << sum << c;
        }
    } else {
        cout << "AHHHHHH" << endl;
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:54:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |         for(int i = 0; i < ct.size(); i++){
      |                        ~~^~~~~~~~~~~
Main.cpp:56:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |             if(i == ct.size()-1){
      |                ~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 59 ms 7664 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -