답안 #1064727

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1064727 2024-08-18T17:13:08 Z cpdreamer Golf (JOI17_golf) C++14
0 / 100
18 ms 348 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <utility>
#define V vector
#define P pair
#define S second
#define F first
#define pb push_back
#define all(v) v.begin(),v.end()
typedef long long ll;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,
        tree_order_statistics_node_update> indexed_set;
static int called = 0;const long long MOD = 1e9+7; // 1e9 + 7

void file(){
    freopen("input.txt.txt","r",stdin);
    freopen("output.txt.txt","w",stdout);
}

struct point{
    int x;
    int y;
    int w;
};
bool sorted(point a,point b){
    return a.x<b.x;
}
void solve() {
    int n;
    cin>>n;
    point A[n];
    for(int i=0;i<n;i++)
        cin>>A[i].x>>A[i].y>>A[i].w;
    sort(A,A+n,sorted);
    ll ans=0;
    for(int i=0;i<n;i++){
        for(int j=i;j<n;j++){
            ll c=0;
            for(int g=i;g<=j;g++){
                c+=A[g].w;
            }
            ans=max(ans,c);
        }
    }
    cout<<ans<<endl;
}
int main(){
    //file();
    solve();
}

Compilation message

golf.cpp: In function 'void file()':
golf.cpp:18:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |     freopen("input.txt.txt","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
golf.cpp:19:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |     freopen("output.txt.txt","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
golf.cpp: At global scope:
golf.cpp:15:12: warning: 'called' defined but not used [-Wunused-variable]
   15 | static int called = 0;const long long MOD = 1e9+7; // 1e9 + 7
      |            ^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -