답안 #930039

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
930039 2024-02-18T09:44:40 Z IUA_Hasin Boat (APIO16_boat) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
 
#define endl                                "\n"
#define finp                                for(int i=0; i<n; i++)
#define fknp                                for(int k=0; k<n; k++)
#define yeap                                cout<<"YES"<<endl
#define nope                                cout<<"NO"<<endl
#define inpintn                             int n; cin>>n
#define inpintarrn                          int arr[n]; for(int i=0; i<n; i++){cin>>arr[i];}
#define inpllarrn                           long long arr[n]; for(int i=0; i<n; i++){cin>>arr[i];}
#define ll                                  long long
 
using namespace std;
 
int main ()
{
    ll M = 1000000007;
    ll n; 
    cin>>n;
    ll arr[n];
    ll brr[n];
    ll ans[n];
    for(int i=0; i<n; i++){
        cin>>arr[i];
        cin>>brr[i];
    }

    for(int i=0; i<n; i++){
        ans[i] = 1;
    }

    for(int i=n-2; i>=0; i--){
        for(int j=i+1; j<n; j++){
            if(arr[j]>arr[i]){
                ans[i]+=ans[j];
            }
        }
    }

    ll sum = 0;
    for(int i=0; i<n; i++){
        sum = (sum+ans[i])%M;
    }
    cout<<sum<<endl;

    // for(int i=0; i<n; i++){
    //     cout << ans[i] << " ";
    // }
    // cout<<endl;
    
 
    return 0;
  
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Incorrect 1 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Incorrect 1 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Incorrect 1 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -