답안 #938383

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
938383 2024-03-05T05:31:07 Z Mohammadamin__Sh 운세 보기 2 (JOI14_fortune_telling2) C++17
4 / 100
3000 ms 2012 KB
//In His Name
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")
using namespace std;
#define ll long long
//#define int ll
typedef pair<int, int> pii;
#define F first
#define S second
#define pb push_back
#define bug(x) cout << "Ah shit , here we go again : " << x <<endl
#define all(x) x.begin() , x.end()
const int maxn = 40000 , MOD = 1e9 + 7;
const ll INF = 1e18 + 100;

int n , k;
pii c[maxn];

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0) , cout.tie(0);

    scanf("%d%d" , &n , &k);
    for(int i = 0 ; i < n ; i++) scanf("%d%d" , &c[i].F , &c[i].S);
    while(k--){
        int t;
        scanf("%d" , &t);
        for(int i = 0 ; i < n ; i++) (t >= c[i].F ? swap(c[i].F , c[i].S) : swap(c[i].F , c[i].F));
    }
    unsigned ll ans = 0;
    for(int i = 0 ; i < n ; i++) ans += c[i].F;
    printf("%llu" , ans);
}

Compilation message

fortune_telling2.cpp: In function 'int32_t main()':
fortune_telling2.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |     scanf("%d%d" , &n , &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~
fortune_telling2.cpp:25:39: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |     for(int i = 0 ; i < n ; i++) scanf("%d%d" , &c[i].F , &c[i].S);
      |                                  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
fortune_telling2.cpp:28:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |         scanf("%d" , &t);
      |         ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 500 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 600 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 500 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 600 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 222 ms 600 KB Output is correct
15 Correct 918 ms 1176 KB Output is correct
16 Correct 2073 ms 1544 KB Output is correct
17 Execution timed out 3014 ms 2012 KB Time limit exceeded
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 500 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 600 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 222 ms 600 KB Output is correct
15 Correct 918 ms 1176 KB Output is correct
16 Correct 2073 ms 1544 KB Output is correct
17 Execution timed out 3014 ms 2012 KB Time limit exceeded
18 Halted 0 ms 0 KB -