QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#344603#7962. 前缀和knightzzz1#RE 0ms0kbC++141.5kb2024-03-04 20:19:172024-03-04 20:19:17

Judging History

This is the latest submission verdict.

  • [2024-03-04 20:19:17]
  • Judged
  • Verdict: RE
  • Time: 0ms
  • Memory: 0kb
  • [2024-03-04 20:19:17]
  • Submitted

answer

#include<bits/stdc++.h>

using namespace std;
 
using ll = long long;
vector<pair<int,int> > v;

bool cmp( pair<int,int> a , pair<int,int> b ){
    if( a.first == b.first ){
        return a.second < b.second ;
    }
    return a.first < b.first ;
}

void solve(){

    int c = 0;v.clear() ;
    for(int i = 0; i < 5; ++i)
        for(int j = 0; j < 5; ++j){
            char x;
            cin >> x;
            if(x == 'o'){
                c++ ;
                v.push_back( { i , j } ) ;
            }
        }

    if(c == 2) cout << "Far\n";
    else if( c == 3 || c == 1 )cout << "Away\n";
    else{
        bool fg = true ;
        for(int i = 0  ; i < 3 ; i ++ ){
            if( v[ i ].first != v[ i + 1 ].first ){
                fg = false ; break;
            }
        }
        if( fg ){
            cout << "Away\n";return ;
        }
        fg = true ;
        for(int i = 0  ; i < 3 ; i ++ ){
            if( v[ i ].second != v[ i + 1 ].second ){
                fg = false ; break;
            }
        }
        if( fg ){
            cout << "Away\n";return ;
        }
        fg = true ;
        sort( v.begin() , v.end() , cmp ) ;
        if( v[ 0 ].first == v[ 1 ].first && v[ 2 ].first == v[ 3 ].first && v[ 0 ].second == v[ 2 ].second ){
            cout << "Away\n";
        }else{
            cout << "Far\n";
        }
    }
}


int main(){
 
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);    

    int T;
    cin >> T;
    while(T--) solve();

    return 0;      
}

详细

Test #1:

score: 0
Runtime Error

input:

3 0.5 1 2

output:


result: